Creates a duplicate of this node.
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.Load("data.xml"); XmlElement elem = doc.CreateElement("misc"); elem.InnerText = "hardcover"; elem.SetAttribute("publisher", "A"); XmlNode elem2 = elem.CloneNode(true); doc.DocumentElement.FirstChild.AppendChild(elem); doc.DocumentElement.LastChild.AppendChild(elem2); doc.Save(Console.Out); } }