score:3

Accepted answer

This should be able to get the maximum temperatures for you, you would just have to change the where filter to get the minimums

 using System.Xml.Linq;
 \\...

 XDocument xmlDoc = XDocument.Load("YourXml.xml");
 var maximums = from tempvalue in xmlDoc.Descendants("temperature").Elements("value")
                           where tempvalue.Parent.Attribute("type").Value == "maximum"
                           select (string)tempvalue;

List<string> returnme = maximums.ToList<string>();
return returnme;

Hope this help.

Note: I'm a bit rusty with my Linq to Xml in C# so it may not be the most elegant solution.

score:0

You'll probably need to parse the xml you get back with xpath to pull out the data you want. There's a brief example here.

Alternatively you could create a class structure that mirrors the xml structure and use the XmlSerializer to deserialize the xml into objects, but that's probably more trouble than it's worth in this case.


Related Articles