On 2010-05-28, Johannes Lichtenberger wrote: > I've got two HTML documents (serialized as XML) which have slightly > different structures at the end because of a stylesheet template rule > based on attributes (and attribute order isn't defined in XML documents > I think):
Order of XML attributes is supposed to be irrelevant, still XMLUnit (1.x for Java) has a difference type for it, but it is considered recoverable. I don't see any attributes on your HTML anyway. > <h4>CATEGORY I</h4> > <table> > <tr> > <td>DESC</td> > <td>Paperback</td> > </tr> > <tr> > <td>CODE</td> > <td>P</td> > </tr> > </table> > vs. > ... > <h4>CATEGORY I</h4> > <table> > <tr> > <td>CODE</td> > <td>P</td> > </tr> > <tr> > <td>DESC</td> > <td>Paperback</td> > </tr> > </table> > You can see that only the tr-elements are exchanged, It's a bit more complex than that. You have to look at the <tr>'s grandchildren (the text nodes inside the <td> elements) to see which <tr>s to match. > but assertXMLEqual fales, even if I change the table structure to > unordered lists, so I assume it's not doable XMLUnit needs help from you to know which <tr>s to compare with each other. This is the purpose of the ElementQualifier <http://xmlunit.sourceforge.net/userguide/html/ar01s03.html#ElementQualifier>. In your case an ElementNameAndTextQualifier wouldn't be enough since you need to match <tr>'s based on the text of their children. RecursiveElementNameAndTextQualifier may work. Stefan ------------------------------------------------------------------------------ _______________________________________________ Xmlunit-general mailing list Xmlunit-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xmlunit-general