// 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(); doc.Load("C:\\test2.xml"); doc.Save(Console.Out); Console.WriteLine(); XmlNodeList elements = doc.GetElementsByTagName("all"); foreach(XmlNode element in elements) { XmlNodeList subelements = element.ChildNodes; foreach(XmlNode subelement in subelements) { Console.WriteLine(subelement.Name + " = " + subelement.FirstChild.Value); } XmlNode add = doc.CreateElement("c"); add.AppendChild(doc.CreateTextNode("***")); element.AppendChild(add); } doc.Save(Console.Out); Console.WriteLine(); } }