Skip to content

Detect ordering-only differences in XML files

This bug was originally reported by Paul Wise (@pabs) in Debian bug #1022146:

Package: diffoscope
Version: 224
Severity: wishlist

It would be nice if diffoscope could detect that XML files are only
different because of ordering differences, currently it cannot:

   $ head -vn-0 *.xml
   ==> bar.xml <==
   <?xml version='1.0' encoding='UTF-8' ?>
   <foo>
   	<bar attr='bar'/>
   	<bar attr='foo'/>
   </foo>

   ==> foo.xml <==
   <?xml version='1.0' encoding='UTF-8' ?>
   <foo>
   	<bar attr='foo'/>
   	<bar attr='bar'/>
   </foo>

   $ diffoscope *.xml
   --- bar.xml
   +++ foo.xml
   │   --- bar.xml
   ├── +++ foo.xml
   │ @@ -1,5 +1,5 @@
   │  <?xml version="1.0" encoding="utf-8"?>
   │  <foo>
   │ -  <bar attr="bar"/>
   │    <bar attr="foo"/>
   │ +  <bar attr="bar"/>
   │  </foo>

   $ echo $?
   1
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information