As an interim solution I ordered the generated tables and rows. I ran into some 
problems with different lexicographic orderings on Oracle and Java though, so 
the problem still persists.

I guess the problem I have is with the documentation is that   
http://xmlunit.sourceforge.net/api/org/custommonkey/xmlunit/Diff.html#similar() 
states that

> Two documents are considered to be "similar" if they contain the same 
> elements and attributes regardless of order.

My first thought was: "That's what I need" as it also met my expectations on 
how the tool should work out of the box. It should be able to do similarity 
checks  disregarding all ordering. I think Oxygen offers an option to do that 
(but thats no Java).



I will have to look into implementing my own ElementQualifier but I think that 
this is a use case which should be covered by XMLUnit.

Thanks
Oliver




Am 24.10.2011 um 15:39 schrieb Stefan Bodewig:

> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xmlunit-general


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to