Merging two xml files in C# without appending and without deleting anything (example given)

后端 未结 3 605
野的像风
野的像风 2021-01-23 07:55

So say I have one xml file such as this:


    shape1

And another xml file like this:

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-23 08:15

    I don't think there is an easy solution. Considering that you are not restricted to merging the contents of the Shapes node, i think you will have to parse through the nodes of one of the document recursively, checking whether each of these nodes is present in the other document through XPath. And once you find a node that is common in both the documents, you can merge the contents of one in the other. It is hardly efficient and there may be a better way but thats the best I can think of.

提交回复
热议问题