I'm using xmlunit 2.2.1 with Java and have the following XMLs to match. The problem here is twofold:
- the order is not the same
- some of the numerical values may have trailing zeroes (e.g.
0.250000
)
For this reason ByNameAndTextRecSelector()
doesn't work because it requires all the text nodes to be exact matches, which not the case here. I already implemented a DifferenceEvaluator
that will take care of the trailing zeroes in the numbers. But what do I use to select the right elements to compare?
XML 1:
<test>
<table>
<row>
<element>
<code>ALPHA</code>
<scale>0.25</scale>
</element>
</row>
<row>
<element>
<code>DELTA</code>
<scale>0.1</scale>
</element>
</row>
</table>
</test>
XML 2:
<test>
<table>
<row>
<element>
<code>DELTA</code>
<scale>0.1</scale>
</element>
</row>
<row>
<element>
<code>ALPHA</code>
<scale>0.2500000</scale>
</element>
</row>
</table>
</test>