CSharp examples for System.Xml:XML Element
Adds a new element as a child of an existing XmlNode and returns it.
// Permission is hereby granted, free of charge, to any person obtaining using System.Xml; using System.Globalization; using System.Collections.Generic; using System;//from w w w. j a v a 2 s . com public class Main{ /// <summary> /// Adds a new element as a child of an existing XmlNode and returns it. /// </summary> /// <param name="node">The node to which the element should be added.</param> /// <param name="name">The element name.</param> /// <returns>The newly created child element</returns> public static XmlNode AddElement(this XmlNode node, string name) { XmlNode childNode = node.OwnerDocument.CreateElement(name); node.AppendChild(childNode); return childNode; } }