// 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.Linq; using System.Xml.Linq; namespace E { public class Program { public static void Main(string[] args) { string s = @" Titel på projekt Ligegyldigdata EventID: E0033
Status: Lukket
Land: Danmark
By: Hjørring
]]>
"; XDocument doc = XDocument.Parse(s); Console.WriteLine(doc.Root.Element("item").Element("description").Value); XDocument doc2 = XDocument.Parse("" + doc.Root.Element("item").Element("description").Value + ""); foreach(XElement elm in doc2.Root.Elements("div")) { Console.WriteLine(elm.Value); } } } }