Mega Code Archive

 
Categories / C# / XML
 

Adds the specified node to the end of the list of child nodes, of this node

using System; using System.IO; using System.Xml; public class Sample {   public static void Main() {     XmlDocument doc = new XmlDocument();     doc.LoadXml("<book genre='novel' ISBN='1-111111-57-5'>" +                 "<title>C#</title>" +                 "</book>");     XmlNode root = doc.DocumentElement;     XmlElement elem = doc.CreateElement("price");     elem.InnerText="9.9";     root.AppendChild(elem);     doc.Save(Console.Out);   } }