First XML
<name>
<firstName>someValue</firstName>
<lastName/>
</name>
<location/>
Second XML
<name>
<firstName/>
<lastName/>
</name>
<name>
<firstName/>
<lastName/>
</name>
<location>someOtherValue</location>
Third XML
<name>
<firstName>someValue</firstName>
<lastName/>
</name>
Fourth XML
<name>
<firstName>someValue</firstName>
<middleName/>
<lastName/>
</name>
<location/>
compare(First XML, Second XML) = similar (It contains the same node elements only it is repeated and value is not taken into account)
compare(First XML, Third XML) = not similar (location tag is missing)
compare(First XML, Fourth XML) = not similar (lastName tag is newly added)
Could anybody help me in comparing the XML in the above said manner?