// 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; namespace E31 { class Program { public static void Main(string[] args) { string xml = @" 6677 25 333 0 0 12 "; XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); Console.WriteLine(doc.OuterXml); XmlDocument doc1 = new XmlDocument(); doc1.LoadXml(doc.SelectNodes(@"/EnticeResponse/data")[0].InnerXml.Replace("row", "xmlSubscriber")); Console.WriteLine(doc1.OuterXml); XmlDocument doc2 = new XmlDocument(); doc2.AppendChild(doc2.CreateElement("xmlSubscriber")); foreach(XmlNode n in doc.SelectNodes(@"/EnticeResponse/data/row/*")) doc2.DocumentElement.AppendChild(doc2.ImportNode(n, true)); Console.WriteLine(doc2.OuterXml); } } }