using System; using System.IO; using System.Xml; public class Sample
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("
"
"
XmlNode root = doc.DocumentElement;
//Create a new node.
XmlElement elem = doc.CreateElement("price");
elem.InnerText="19.95";
//Add the node to the document.
root.AppendChild(elem);
Console.WriteLine("Display the modified XML...");
doc.Save(Console.Out);
}
}
http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.appendchild.aspx
No comments:
Post a Comment