Reputation: 403
I am pretty new to comparing the xmls in c#. Can somebody suggest me a easy and performant way to do the same. Below is my requirement.
Source XML file:
<a>
<b>hello</b>
<c>
<d>
<e>abcd</e>
</d>
</c>
<f>image1</f>
</a>
Destination XML file:
<a>
<b1>hello</b1>
<c>
<d>
<e>thguh</e>
</d>
</c>
<f>image2</f>
</a>
In the xml files as for tag, i don't want to see it as difference as it is intended. Hence i want to filter out such differences and see if there are any other differences like node values and node names. Comparing node values and filtering the image value changes and finally telling the differences is my priority.
Upvotes: 0
Views: 181
Reputation: 15881
you can use XMLDiff to compare the xml files XML Differance and compare
XmlDiff xmldiff = new XmlDiff(XmlDiffOptions.IgnoreChildOrder |
XmlDiffOptions.IgnoreNamespaces |
XmlDiffOptions.IgnorePrefixes);
then compare
bool bIdentical = xmldiff.Compare(originalFile, newFile, false, diffgramWriter);
diffgramWriter.Close();
Upvotes: 3