CSharp examples for System.Xml:XML Element
Set XML Element Text
using System.Xml; using System.Text; using System.Linq; using System.Collections.Generic; using System;//from w w w .j a v a 2 s .c o m public class Main{ public static void SetElementText(this XmlElement parent, string elemName, string value) { XmlElement element = parent.CreateChildElement(elemName); XmlText text = parent.OwnerDocument.CreateTextNode(value); element.AppendChild(text); } public static XmlElement CreateChildElement(this XmlElement parent, string elemName) { XmlElement element = parent.OwnerDocument.CreateElement(elemName); parent.AppendChild(element); return element; } }