On 2011-10-24, Oliver Schrenk wrote:

> I'm trying to write a XMLUnitTest that compares to XMLDocuments that 
> basically have to layers of elements, that can be out of order.

>       <root>
>               <table>
>                       <id>1</id>
>                       <row>
>                               <c>a</c >
>                               <c>b</c >
>                       </row>
>               </table>
>               <table>
>                       <id>2</id>
>                       <row>
>                               <c>b</c >
>                               <c>a</c >
>                       </row>
>               </table>
>       </root>

This - like most any question on XMLUnit we've had in a long while,
seems we need better docs - boils down to ElementQualifiers.  You must
help XMLUnit to pick the correct branches to compare.

For your use-case neither of the built-in ElementQualifiers will do.
You'll have to write one yourself but that shouldn't be too hard.

If the two elements you are comparing are both <table>-elements, then
look into the text content of the only id child and say they are only
qualified to be compared it those contents match.  For any other element
you can re-use the logic (or even an instance) of
ElementAndTextQualifier as it will pick the correct <c> elements to
compare.

HTH

        Stefan

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Xmlunit-general mailing list
Xmlunit-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to