What is the fastest way to combine two xml files into one

后端 未结 11 1554
广开言路
广开言路 2020-11-29 01:43

If I have two string of xml1 and xml2 which both represent xml in the same format. What is the fastest way to combine these together? The format is not important, but I ju

11条回答
  •  温柔的废话
    2020-11-29 02:05

    If I were doing this (using C#), I would create a class that I can deserialize this XML to (you can use xsd.exe to do this), and then loop through all the nodes in the object representing the first piece of XML and "Add" them to the AllNodes property of the object representing the second XML.

    Then serialize the second class back out the XML, and it should look like your 3rd example.

提交回复
热议问题