I am using xmlunit to compare two text files. The control xml is:
<books>
<book>
<name>Angels & Demons</name>
<isbn>9971-5-0210-0</isbn>
<author>Dan Brown</author>
<category></category>
</book>
</books>
I am comparing this against another piece of xml that has the and elements swapped.
<books>
<book>
<isbn>9971-5-0210-0</isbn>
<name>Angels & Demons</name>
<author>Dan Brown</author>
<category></category>
</book>
</books>
The Diff object reports the following difference:
Expected sequence of child nodes '1' but was '3' - comparing <name...> at /books[1]/book[1]/name[1] to <name...> at /books[1]/book[1]/name[1]
If <name>
is child node '1', wouldn't <isbn>
be child node '2'?
It seems like XmlUnit is counting carriage returns in the xml as child nodes. Setting the following XMLUnit.setIgnoreWhitespace(true); gave a more intuitive result of Expected sequence of child nodes '0' but was '1' - comparing <int...> at /struct[1]/int[1] to <int...> at /struct[1]/int[1]