I have two similar xml string. I use XMLUnit to compare them but after I run some sample test to check them it says that they aren't similar and identical. I agree that they aren't identical but I think it should return true for similar. Below are my strings and test code that I run.
<Errors>
<Error>
<Sheet>Sample1</Sheet>
<ErrorCode>4</ErrorCode>
<Columns>
<Column>Id</Column>
<Column>Name</Column>
</Columns>
</Error>
<Error>
<Sheet>Sample2</Sheet>
<ErrorCode>4</ErrorCode>
<Columns>
<Column>Id</Column>
<Column>Name</Column>
</Columns>
</Error>
</Errors>
and
<Errors>
<Error>
<Sheet>Sample1</Sheet>
<ErrorCode>4</ErrorCode>
<Columns>
<Column>Name</Column>
<Column>Id</Column>
</Columns>
</Error>
<Error>
<Sheet>Sample2</Sheet>
<ErrorCode>4</ErrorCode>
<Columns>
<Column>Name</Column>
<Column>Id</Column>
</Columns>
</Error>
</Errors>
The only difference is that Column nodes are reversed but i think it should return that both string are similar.
public void test() throws Exception{
String myControlXML = "here goes xml1";
String myTestXML = "here goes xml2";
Diff myDiff = new Diff(myControlXML, myTestXML);
System.out.println("pieces of XML are similar " + myDiff.similar());
System.out.println("but are they identical? " + myDiff.identical());
}