Close an element
using System; using System.IO; using System.Xml; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; public class MainClass{ public static void Main(){ XmlTextWriter w = new XmlTextWriter(Console.Out); w.WriteStartElement("x","root","urn:1"); w.WriteStartElement("y","item","urn:1"); w.WriteEndElement(); w.WriteEndElement(); w.Close(); } }