java - how to compare two xml with different attribute values in same tags -


i use xunit. me 2 identical xml, test failed. how compare them using xunit? or else?

public void testidentical() throws exception {         string mycontrolxml = "<struct>" +                 "<int a=\"1\"></int>" +                 "<int a=\"2\"></int>" +                 "</struct>";         string mytestxml = "<struct>" +                 "<int a=\"2\"></int>" +                 "<int a=\"1\"></int>" +                 "</struct>";         diff mydiff = new diff(mycontrolxml, mytestxml);         asserttrue("my test" + mydiff, mydiff.similar()); }  java.lang.assertionerror: test org.custommonkey.xmlunit.diff [different] expected attribute value '1' '2' - comparing <int a="1"...> @ /struct[1]/int[1]/@a <int a="2"...> @ /struct[1]/int[1]/@a 

this looks bug in xmlunit. documentation:

two documents considered "similar" if contain same elements , attributes regardless of order.

you try reformatting them apply specific, canonical, order before passing them diff.


Comments