The following test fails:
public void testDiffSimilar() throws Exception
String a = "<a><b val=\"c\" /><b val=\"d\" /></a>";
String b = "<a><b val=\"d\" /><b val=\"c\" /></a>";
Diff diff = new Diff(a, b);
What would I need to do to make the comparison work?
You need to help XMLUnit to determine which XML elements it should compare. By default it will compare elements with the same element names in order.
You want to specify a custom ElementQualifier http://xmlunit.sourceforge.net/userguide/html/ar01s03.html#ElementQualifier - to be specific in your case you want to use a ElementNameAndAttributeQualifier.
Thanks! That solved my problem.
Log in to post a comment.