Sorting XML files so that differences can then be found

Solution 1:

I think you can use a tool such as xmldiff for this purposes.

http://diffxml.sourceforge.net/

On the tools webpage it states:

The standard Unix tools diff and patch are used to find the differences between text files and to apply the differences. These tools operate on a line by line basis using well-studied methods for computing the longest common subsequence (LCS).

Using these tools on hierarchically structured data (XML etc) leads to sub-optimal results, as they are incapable of recognizing the tree-based structure of these files.