using System;
using System.Xml;
public class Sample {
public static void Main() {
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book>" +
" <title>AAA</title>" +
" <price>5.95</price>" +
"</book>");
XmlNode newElem;
newElem = doc.CreateNode(XmlNodeType.Element, "pages", "");
newElem.InnerText = "290";
XmlElement root = doc.DocumentElement;
root.AppendChild(newElem);
Console.WriteLine(doc.OuterXml);
}
}
|