开发者

Comparing two XML files in C#

I'm trying to find a fairly easy way to compare two XML files in C#.

I need the output of this comparison to be:

  • what is the difference in XML structure (including inner chi开发者_如何学Cldren and so on).
  • what is the difference in the values(for example: 1 and 2 will count as a difference).

I also need the ability to disregard certain changes in value.

For example, the comparison will receive a number of values that their value is irrelevant.

Thanks in advance!

Hadar


Comparing XML documents is non-trivial. Since you're using .NET you might want to take a look at the XML Diff and Patch stuff from Microsoft (the page contains some code examples).

The libraries generate a "diffgram" – an XML representation of the delta between two documents, and you may need to perform further operations on this to zero-in on the changes you are interested in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜