I have unit test solution which basically compare two xmls generated by two diff software.
Issue is one xml has 2 values n lowercase and other has it in upper case like below.
1st
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
2nd
<IsMirrored>false</IsMirrored>
<IsVariable>true</IsVariable>
I use this method to compare xml:
Assert.AreEqual(originalDoc.OuterXml, newDoc.OuterXml);
but it returns false when it compare value because of lower and uppercase issue. How would I ignore that case issue and it only compares value?
EDIT : One more Issue
Another issue is : if there is an empty element:
1st:
<LinkedObjectName></LinkedObjectName>
2nd:
<LinkedObjectName />
If I do Assert.AreEqual, it will do character by character checking and it breaks here.
How I can handle this ?
Don’t use
Assert.AreEqual, useAssert.IsTrueandString.EqualsEdit:
For a more robust comparision of the two XML documents, you can try using the XML Diff and Patch Tool from Microsoft. The tool tries to determine if the content of your XML documents is equivalent even in cases where a simple string comparison would fail, such as different ordering of nodes or attributes.