"One approach would be to first turn both XML files into Canonical XML, and compare the results using diff. For example, xmllint can be used to canonicalize XML.
"Tried to use @Jukka Matilainen's answer but had problems with white-space (one of the files was a huge one-liner). Using --format helps to skip white-space differences.
"My Python script xdiff.py for comparing XML files ignores differences in whitespace or attribute order (in contrast to element order).
In order to compare two files 1.xml and 2.xml, you would run the script as follows:
xdiff.py 1.xml 2.xml
In the OP's example, it would output nothing and return exit status 0 (for no structural or textual differences).
In cases where 1.xml and 2.xml differ structurally, it mimics the unified output of GNU diff and returns exit status 1. There are various options for controlling the output, such as -a for outputting all context, -n for outputting no context, and -q for suppressing output altogether (while still returning the exit status)."
"If anyone stumbles upon this and is a developer and knows programming languages, then you can also check XML difference using XMLUnit in C# or JAVA. For checking how does it show's difference you can try this online XML difference checker tool C# Sample Code to check difference string control = ""<a><b attr=\""abc\""></b></a>""; string test = ""<a><b attr=\""xyz\""></b></a>"";
var myDiff = DiffBuilder.Compare(Input.FromString(control)) .WithTest(Input.FromString(test)) .Build();