I'm using xmlunit for the first time to compare 2 pieces of xml. It shows great promise but has failed at the first hurdle. It is comparing two almost identical pieces of xml and claims that they are different.
Diff diff = new Diff(control, test);
diff.overrideDifferenceListener(new IgnoreTextAndAttributeValuesDifferenceListener());
The result returned by xmlunit is as follows:
[different] Expected number of child nodes '3' but was '2' - comparing <SOAP-ENV:Envelope...> at /Envelope[1] to <SOAP-ENV:Envelope...> at /Envelope[1]
But the xml is pretty much the same. Here's the control:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope">
<SOAP-ENV:Body>
<v:messagegroup xmlns:v="http://www.outfit.net/chargingandpayments/message/1.0">
<v:request>
<v:msgcontrol>
<v:country>GB</v:country>
<v:caller>
<v:name>CORE</v:name>
<v:signature>Signature</v:signature>
<v:version>v10</v:version>
</v:caller>
<v:headers/>
</v:msgcontrol>
<v:validate>
<v:accountId>MSISDN</v:accountId>
</v:validate>
</v:request>
</v:messagegroup>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
and here's the test String:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope">
<SOAP-ENV:Body>
<v:messagegroup xmlns:v="http://www.outfit.net/chargingandpayments/message/1.0">
<v:request>
<v:msgcontrol>
<v:country>GB</v:country>
<v:caller>
<v:name>CORE</v:name>
<v:signature>Signature</v:signature>
<v:version>v10</v:version>
</v:caller>
<v:headers />
</v:msgcontrol>
<v:validate>
<v:accountId>lblabla</v:accountId>
</v:validate>
</v:request>
</v:messagegroup>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
What am I doing wrong?