Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Working on my current task I'm encountered with problem in comparison of 2 xml files.
Maybe anybody knows in which way i could compare those files as fast as it possible in NET 4.0.
The main idea of comparison is to assert, that those documents are identical:
- no nodes are added
- no nodes are removed
- no values are changed.

All answers will consider as acceptable =)

At first mind , i look forward to consider their equality by comparing text of documents, but i now, that way is sucks =))
Posted

Have a look at this Microsoft article on XML Difference:
MSDN: Using the XML Diff and Patch Tool in Your Applications[^]

Another way: Diff in XML files with LINQ[^]

An interesting open source project: DiffPlex - a .NET Diff Generator[^]
 
Share this answer
 
Comments
VJ Reddy 15-Jun-12 10:57am    
Good references. 5!
Sandeep Mewara 15-Jun-12 14:25pm    
Thanks VJ.
Oleksandr Kulchytskyi 15-Jun-12 13:09pm    
thanks)
Sandeep Mewara 15-Jun-12 14:25pm    
Welcome.
Manas Bhardwaj 15-Jun-12 17:09pm    
Good answer +5
The easiest way is read both the files in string object and check if both the strings are equal (use string comparision with case sensitive). The only thing to consider on top of this is additional spaces between few nodes.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900