Can you not append a XmlWhiteSpace node to XmlDocument?
See example:
using System;
using System.Xml;
class TestXml
{
public static void Main(string[] args)
{
string xmlDoc = @"<root><child>a</child></root>";
string newXml = @"
<child>b</child>
<child>c</child>
";
XmlDocument d = new XmlDocument();
d.LoadXml(xmlDoc);
XmlElement tmpNode = d.CreateElement("newNodes");
tmpNode.InnerXml = newXml;
//there are 5 nodes, 2 Elements
Console.WriteLine("Number of nodes: " + tmpNode.ChildNodes.Count);
int i = 0;
foreach(XmlNode n in tmpNode)
{
//HMM: should run 5 times right since tmpNode has 5 children but only
runs once!?
//HOWEVER, if you simply add NON-whitespace nodes, it'll work correctly
Console.WriteLine("NODE: " + i++ + ", " + n);
//now append the child node
d.AppendChild(n);
}
}
}