XML and .NET: How to replace specific node with many other ones loaded from raw xml data

Posted by Entrase on Stack Overflow See other posts from Stack Overflow or by Entrase
Published on 2010-04-18T12:08:59Z Indexed on 2010/04/18 12:13 UTC
Read the original article Hit count: 227

Filed under:
|
|
|
|

Let's suppose we have an element like this one in the main xml file: <group name="gr1" filename="groups/gr1.xml"/>. The second file gr1.xml contains something like this:

<item name="i1">Item one</item>
<item name="i2">Item two</item>
<item name="i3">Item three</item>

Note that there is no XML declaration in gr1.xml, just plain items without single parent node.

So… Which is the best way to replace <group/> with its <item/>s?

I have already tried some things like manual enclosing of gr1.xml content into a single node with XML declaration and loading it into XmlDocument, but it doesn't look like a good solution.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about .NET