On Linux, how could I generate a diff between two XML files?
Ideally, I would like to be able configure it to some things strict, or loosen some things, like whitespace, or attribute order.
I'll often care that the files are functionally the same, but diff by itself, would be annoying to use, especially if the XML file doesn't have a lot of linebreaks.
For example, the following should really be okay to me:
<tag att1="one" att2="two">
content
</tag>
<tag att2="two" att1="one">
content
</tag>
vimdiff <(xmllint --c14n one.xml) <(xmllint --c14n two.xml)– Nathan Villaescusa Mar 03 '13 at 01:53xmllint --formatmay be helpful (see other answers) – törzsmókus Jun 03 '19 at 06:43--formatto decrease my effort but it actually had trouble with indenting and increased the output size. This is libxml2-utils version 2.9.4+dfsg1-7+deb10u2 amd64 - maybe newer versions don't trip on this. – Bill McGonigle Jan 20 '22 at 16:46XMLLINT_INDENT=" " xmllint --format ...because --c14n does NOT unify tabs versus spaces at the beginning of the lines, thus the files where still different. – masterxilo Mar 08 '22 at 14:33