Hi,
I am trying to compare 2 XML files using XMLUnit 1.2. I am using the RecursiveElementNameAndTextQualifier() qualifier.
When changing the order of some entities order in my XML, it causes XMLUnit to pass on some cases and fail on other cases.
My XML file looks like this, and I'm comparing it to a similar copy with a simple location swapping of one peer of attributes.
<root>
<ent>
<value>
<int>1</int>
</value>
<value>
<int>2</int>
</value>
</ent>
<ent>
<value>
<int>3</int>
</value>
<value>
<int>4</int>
</value>
</ent>
</root>
When swapping int: 1 with int: 2 , in one of the XML files, the test fails. But when swapping int:4 with int:3 it keeps passing.
Here is my testing code:
public void testRecursiveElement() throws Exception {
InputSource xml1 = new InputSource("xml1.xml");
InputSource xml2 = new InputSource("xml2.xml");
Diff myDiff = new Diff(xml1, xml2);
myDiff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier() );
assertXMLEqual("Not similar", myDiff, true);
}
Can you advice what is the problem , and why does XMLUnit detect a diff in the first case and not in the second case. Is there any solution to this problem ?