Search This Blog

Tuesday, December 24, 2013

AppendChild C# XML Example

C# > XML > AppendChild

AppendChild adds node to the end of the list of child nodes.

Example

XmlDocument doc = new XmlDocument();
doc.LoadXml(yourxml
);
XmlNode root = doc.DocumentElement;
XmlElement elem = doc.CreateElement("price");
elem.InnerText = "100";
root.AppendChild(elem);

MessageBox.Show(root.OuterXml);