// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; using System.Text; using System.Xml; class MainClass { public static void Main(string[] args) { XmlTextWriter xtw = new XmlTextWriter("C:\\z.xml", Encoding.UTF8); xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); xtw.WriteStartElement("mydoc"); xtw.WriteStartElement("header"); xtw.WriteString("eksempel"); xtw.WriteEndElement(); xtw.WriteStartElement("html"); xtw.WriteCData("abc"); xtw.WriteEndElement(); xtw.WriteEndElement(); xtw.WriteEndDocument(); xtw.Close(); } }