Creates the element.
using System; using System.Xml; public class Utility { /// <summary> /// Creates the element. /// </summary> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <param name="innerText">The inner text.</param> /// <param name="nsMgr">The ns MGR.</param> /// <returns></returns> public static XmlElement CreateElement(XmlElement parent, string name, string innerText, XmlNamespaceManager nsMgr) { if (parent == null) throw new Exception("Passed in a null node, which should never happen."); XmlElement element = parent.OwnerDocument.CreateElement(name, nsMgr.LookupNamespace("ns1")); XmlElement newElement = (XmlElement)parent.AppendChild(element); newElement.InnerText = innerText; return (XmlElement)parent.AppendChild(newElement); } }