Replace Children
using System;
using System.Xml;
class MainClass
{
static void Main(string[] args)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<Record> Some Value </Record>");
XmlElement root = xmlDoc.DocumentElement;
string str = root.ToString();
XmlDocumentFragment xmlDocFragment = xmlDoc.CreateDocumentFragment();
xmlDocFragment.InnerXml="<F><S>Data</S></F>";
XmlElement rootNode = xmlDoc.DocumentElement;
rootNode.ReplaceChild(xmlDocFragment, rootNode.LastChild);
xmlDoc.Save(Console.Out);
}
}
Output Data
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
-
-
|