// 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 E { public class Program { public static void Main(string[] args) { string s = @" ee26dbd0-af6b-4f1a-816c-f7409cffaf38 101 Reykjavík 3d1a5fbf-4310-43ba-ab09-dc39364b0dbd 103 Reykjavík "; XmlDocument doc = new XmlDocument(); doc.LoadXml(s); string id = "3d1a5fbf-4310-43ba-ab09-dc39364b0dbd"; XmlNode zip = doc.SelectSingleNode("//zipCodes/zip[cityID/text()='" + id + "']"); string code = zip.SelectSingleNode("code/text()").Value; string city = zip.SelectSingleNode("name/text()").Value; Console.WriteLine(code + " " + city); } } }