simple way to merge xml documents

  • Thread starter Thread starter Random
  • Start date Start date
R

Random

Is there a quick way to merge multiple xml documents into a common one with
a new root node?

That is...

MyFirstBook.xml
<book title="bookA">...</book>

MySecondBook.xml
<book title="bookB">...</book>

MyThirdBook.xml
<book title="bookC">...</book>

combined into...

AllMyBooks.xml
<books>
<book title="bookA">...</book>
<book title="bookB">...</book>
<book title="bookC">...</book>
</books>

I know some amount of coding is involved, of course. I'm not looking for a
three-lines-of-code implementation. But I'm hoping someone can suggest the
best classes and routines to use so I don't have to create half a dozen or
so XmlNode, XmlDocument, XmlFragment, and/or XmlReader objects to get what I
want.
 
Hello Random,

I would look at the ImportNode and AppendChild methods of the XmlDocument
class.
 
Back
Top