// 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.Xml; class MainClass { public static void Main(string[] args) { XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("all"); root.SetAttribute("xmlns:a", "http://www.a.org/a"); root.SetAttribute("xmlns:b", "http://www.b.org/b"); doc.AppendChild(root); XmlElement e1 = doc.CreateElement("one"); e1.AppendChild(doc.CreateTextNode("100")); root.AppendChild(e1); XmlElement e2 = doc.CreateElement("two"); e2.AppendChild(doc.CreateTextNode("200")); root.AppendChild(e2); doc.Save(Console.Out); } }