Mega Code Archive

 
Categories / C# / XML
 

Gets or sets the tag format of the element

using System; using System.Xml; public class Sample {   public static void Main() {       XmlDocument doc = new XmlDocument();       doc.LoadXml("<book>"+                    "  <title>C#</title>" +                   "  <price/>" +                   "</book>");            XmlElement currNode = (XmlElement) doc.DocumentElement.LastChild;       if (currNode.IsEmpty)         currNode.InnerXml="19.95";        Console.WriteLine(doc.OuterXml);   } }