// 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.Collections.Generic; using System.Xml; namespace E { public class Data { public string A { get; set; } public string B { get; set; } public override string ToString() { return "[" + A + "," + B + "]"; } } public class Program { public static void Main(string[] args) { List lst = new List(); XmlDocument doc = new XmlDocument(); doc.Load(@"C:\big.xml"); foreach(XmlNode n in doc.SelectNodes("//all/rec/obj")) { lst.Add(new Data{ A=n.SelectSingleNode("a/text()").Value, B=n.SelectSingleNode("b/text()").Value}); } foreach(Data d in lst) { Console.WriteLine(d); } } } }