I think this link may help you - http://www.ibm.com/developerworks/java/library/j-cq121906.html#N10158
Basically, if your File1 is like -
<account> <id>3A-00</id> <name>acme</name> </account>
And File2 is the same, but only different from <name> and <id> -
<account> <name>acme</name> <id>3A-00</id> </account>
You can then write a test, as shown below, that will compare them and return similar ones.
public void testIdenticalAndSimilar() throws Exception { String controlXML = "<account><id>3A-00</id><name>acme</name></account>"; String testXML = "<account><name>acme</name><id>3A-00</id></account>"; Diff diff = new Diff(controlXML, testXML); assertTrue(diff.similar()); assertFalse(diff.identical()); }
Hope this helps.
source share