Add XML Text Element - CSharp System.Xml

CSharp examples for System.Xml:XML Element

Description

Add XML Text Element

Demo Code


using System.Xml;

public class Main{
        public static void AddTextElement(this XmlElement elem, string newElemName, string text)
        {// w  ww.  j  a  v  a  2  s  . c  o  m
            XmlElement newElem = elem.OwnerDocument.CreateElement(newElemName);
            newElem.InnerText = text;
            elem.AppendChild(newElem);
        }
}

Related Tutorials