Append element : Xml Node « XML « C# / CSharp Tutorial






using System;
using System.Xml;

class MainClass
{
  static void Main(string[] args)
  {
    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<book genre='programming'>" +
      "<title>Programming</title>" +
      "</book>");

    XmlNode root = doc.DocumentElement;

    XmlElement newbook = doc.CreateElement("price");
    newbook.InnerText="44.95";

    root.AppendChild(newbook);

    doc.Save(Console.Out);
  }
}


  Programming
  44.95








30.11.Xml Node
30.11.1.Read an XML file and displays each of the nodes.
30.11.2.Find nodes by name
30.11.3.Select Nodes By Namespace from XmlDocument
30.11.4.XmlNode: InsertAfter FirstChild
30.11.5.Xml Node List
30.11.6.Select nodes from XmlDocument
30.11.7.Recursively display XmlNode
30.11.8.Replace Children
30.11.9.Root Node
30.11.10.Insert after
30.11.11.Append element
30.11.12.Get current value and depth during the XML document reading process
30.11.13.Read XML document by node type
30.11.14.Check for Xml node name
30.11.15.Extract elements for types
30.11.16.Get elements
30.11.17.Select By Specific Author Node
30.11.18.Write types to the console
30.11.19.Select node by node text