xml comparison code in .Net
Hi my project required me to compare two xml files, which are having same format but different data.
Show those differences and merge the files to produce a new file.
Is there any way to do this using c#?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Nov 6, 2009, 3:39 PM
You can read the XML data into collections using the XmlSerializer Class, then sort it if necessary, then write a simple compare. Assuming there is not other data to be written, the merged data could be written using the XmlSerializer Class.
VinayaPosted Nov 6, 2009, 1:03 AM
naura paxPosted Nov 5, 2009, 3:54 AM
which version are you using? if it is 3.5 you can use LINQ to xml to query data from one xml and write it into another
while there is a document way of doing it with datasets in this link:
http://support.microsoft.com/kb/311530
while this is one straight copy node to node just read the answer in the given post:
http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=28347