如何比较两个XML文件,并使用C#添加缺少的元素 [英] How to compare two XML files and add missing elements using c#

查看:316
本文介绍了如何比较两个XML文件,并使用C#添加缺少的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,一个或多个XML元素从XML文件丢失。眼下,一个解决我在想是比较具有硕士XML文件(具有所有元素)的XML文件,如果任何元素是缺少然后在XML文件从主文件添加元素。

Occasionally, one or more XML Elements are missing from XML File. Right now, one work around i am thinking is to compare XML file with a master XML File (having all the elements) and if any element is missing then add that element in XML File from master file.

我要如何做到这一点或任何其他更好的主意?

How i gonna achieve this or any other better idea?

推荐答案

一个我,而只是希望微软的站点周围发现最酷的图书馆是XmlDiffPatch库。您可以在 http://msdn.microsoft.com/en-us找到更多的信息/library/aa302294.aspx 但它本质上可以让你比较两个文件,​​发现所有的差异,然后将这些差异。非常有用COM pressing XML文件通过网络发送

One of the coolest libraries I've found while just looking around the Microsoft site is the XmlDiffPatch library. You can find more information at http://msdn.microsoft.com/en-us/library/aa302294.aspx but it essentially allows you to compare two documents, find all the differences and then apply those differences. Very useful for compressing xml files to send across a network

这篇关于如何比较两个XML文件,并使用C#添加缺少的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆