Is there a library to compare two XML files including all imported XSD files? I need to know differences through the whole tree.
I need to know the individual differences because I need to report on them, not just that the files are different.
XMLUnit does the trick
public class XMLComparer extends XMLTestCase {
@Test
public void test() {
String xml1 = "XMLFIle1";//
String xml2 = "XMLFIle2";//
XMLUnit.setIgnoreWhitespace(true); // ignore whitespace differences
// can also compare xml Documents, InputSources, Readers, Diffs
assertXMLEquals(xml1, xml2); // assertXMLEquals comes from XMLTestCase
}
}