The Compare action has two modes of operation, either producing detailed differences or basic information. In the simple output mode, the results will just indicate whether the two XML structures are +?+?++identical+?+?+?, +?+?++similar+?+?+? or +?+?++different+?+?+?. The XML fragments will be considered 'similar' if they have the same content, but the ordering or whitespace information is different.
If the detailed output is chosen, then you get this information, along with the details of all differences between the two fragments.
The following XML shows the output of both the basic and detailed comparison of two +?+?++contact+?+?+? XML fragments.
and
The basic output would produce
The detailed output would produce
The following two examples show the type of +?+?++Difference+?+?+? fragments you would receive in the detailed output in the case where an element has been added or removed from the XML.
If the detailed output is chosen, then you get this information, along with the details of all differences between the two fragments.
The following XML shows the output of both the basic and detailed comparison of two +?+?++contact+?+?+? XML fragments.
<contact xmlns="http://www.hyfinity.com/schemas" id="1">
<title>Mr</title>
<forename>Fred</forename>
<surname>Bloggs</surname>
<date_of_birth>1970-07-23</date_of_birth>
<contact_type>
<name>home_phone</name>
<value>01215069113</value>
</contact_type>
</contact>
and
<contact xmlns="http://www.hyfinity.com/schemas" id="1">
<title>Mr</title>
<forename>Joe</forename>
<surname>Bloggs</surname>
<date_of_birth>1970-07-23</date_of_birth>
<contact_type>
<name>home_phone</name>
<value>01215069111</value>
</contact_type>
</contact>
The basic output would produce
<CompareResults>
<Result>different</Result>
<DetailedResults>Expected text value 'Fred' but was 'Joe' - comparing <forename ...>Fred</forename> at /contact[1]/forename[1]/text()[1] to <forename ...>Joe</forename> at /contact[1]/forename[1]/text()[1]</DetailedResults>
</CompareResults>
The detailed output would produce
<CompareResults>
<Result>different</Result>
<DetailedResults>
<Difference>
<Description>text value</Description>
<Source>
<XPath>/contact[1]/forename[1]/text()[1]</XPath>
<Value>Fred</Value>
</Source>
<Target>
<XPath>/contact[1]/forename[1]/text()[1]</XPath>
<Value>Joe</Value>
</Target>
</Difference>
<Difference>
<Description>text value</Description>
<Source>
<XPath>/contact[1]/contact_type[1]/value[1]/text()[1]</XPath>
<Value>01215069113</Value>
</Source>
<Target>
<XPath>/contact[1]/contact_type[1]/value[1]/text()[1]</XPath>
<Value>01215069111</Value>
</Target>
</Difference>
</DetailedResults>
</CompareResults>
The following two examples show the type of +?+?++Difference+?+?+? fragments you would receive in the detailed output in the case where an element has been added or removed from the XML.
<Difference>
<Description>element tag name</Description>
<Source>
<XPath>/contact[1]/date_of_birth[1]</XPath>
<Value>date_of_birth</Value>
</Source>
<Target>
<XPath>/contact[1]/contact_type[1]</XPath>
<Value>contact_type</Value>
</Target>
</Difference>
<Difference>
<Description>number of child nodes</Description>
<Source>
<XPath>/contact[1]/contact_type[1]</XPath>
<Value>5</Value>
</Source>
<Target>
<XPath>/contact[1]/contact_type[1]</XPath>
<Value>7</Value>
</Target>
</Difference>