simple way to merge xml documents

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.
 
M

Matt Berther

Hello Random,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top