尝试让这两个 XML 类似(想忽略 xmlns)和不同的元素序列,但对我来说不能正常工作。如果删除 xmlns,则 doc 是 simmilr。我正在使用 XMlUnit 1.5
String s1 = "<root xmlns=\"http:example.com\">"
+"<Date/>"
+"<Time/>"
+"</root>";
String s2 = "<root>"
+"<Time/>"
+"<Date/>"
+"</root>";
myDiff = XMLUnit.compareXML(s1,s2);