|
From: Mirko S. <mir...@iw...> - 2011-09-04 23:17:32
|
Hi people,
xmlunit seems to be a great help for me. Thanks!
However, I have difficulties doing comparisons of complex xml data.
Please see the following example:
control:
----------
<listOfFunctionDefinitions>
<functionDefinition id="func1">
<tag0:math xmlns:tag0="http://www.w3.org/">
<tag0:bvar>
<tag0:ci> A </tag0:ci>
</tag0:bvar>
<tag0:bvar>
<tag0:ci> B </tag0:ci>
</tag0:bvar>
</tag0:math>
</functionDefinition>
</listOfFunctionDefinitions>
<listOfSpecies>
<species id="spec1">
<rdf:Bag>
<rdf:li resource="res1"/>
<rdf:li resource="res2"/>
</rdf:Bag>
</species>
<species id="spec2">
<rdf:Bag>
<rdf:li resource="res3"/>
<rdf:li resource="res4"/>
</rdf:Bag>
</species>
</listOfSpecies>
test:
------
<listOfFunctionDefinitions>
<functionDefinition id="func1">
<tag0:math xmlns:tag0="http://www.w3.org/">
<tag0:bvar>
<tag0:ci> B </tag0:ci>
</tag0:bvar>
<tag0:bvar>
<tag0:ci> A </tag0:ci>
</tag0:bvar>
</tag0:math>
</functionDefinition>
</listOfFunctionDefinitions>
<listOfSpecies>
<species id="spec2">
<rdf:Bag>
<rdf:li resource="res3"/>
<rdf:li resource="res4"/>
</rdf:Bag>
</species>
<species id="spec1">
<rdf:Bag>
<rdf:li resource="res1"/>
<rdf:li resource="res2"/>
</rdf:Bag>
</species>
</listOfSpecies>
In this test case, the nodes <tag0:ci> A and B (from the first half) as
well as <species id="spec1"> and "spec2" (from the second half) were
interchanged.
I consider the test case to equal the control case, but xmlunit tells me
it is different.
Since I have a deep hierarchical structure I need recursive comparison
as provided by ElementNameAndAttributeQualifier or
ElementNameAndTextQualifier. However, since the differences are not
solely expressed as text or attribute differences, these element
qualifiers can't be used. When I use ElementNameAndAttributeQualifier,
then only the species nodes are found to be equal. On the other hand, if
I use ElementNameAndTextQualifier only the nodes tag0:ci are detected as
equal.
Is there a way to combine these two qualifiers?
Thanks,
Mirko
|