I'm trying to get the attributes value of this yahoo weather XML element:
<yweather:wind chill="24" direction="340" speed="28.97" />
like this:
XDocument XResult = XDocument.Parse(e.Result);
XElement location = XResult.Elements(XName.Get("wind", "yweather")).FirstOrDefault();
XAttribute city = location.Attributes(XName.Get("chill")).FirstOrDefault();
XAttribute direction = location.Attributes(XName.Get("direction")).FirstOrDefault();
XAttribute speed = location.Attributes(XName.Get("speed")).FirstOrDefault();
but it tells me object not set to an instance. How can I fix this?