public static void compare(String a, String b) throws Exception {
StringBuilder message = new StringBuilder();
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLEventReader rA = factory.createXMLEventReader(new StringReader(a));
XMLEventReader rB = factory.createXMLEventReader(new StringReader(b));
if (!compare(rA, rB, message)) {
throw new Exception(message.toString());
}
}