I’ve been playing around with some linq to xml, and I’m having some problems parsing http://www.nationalbanken.dk/dndk/valuta.nsf/valuta-hist.xml , which is a list showing currency rates for the last five days, in danish.
I’m trying to get all the “cubes” here the attribute “currency” is equal to a specific value.
Until now, I have the following:
Stream stream = e.Result;
XDocument doc = XDocument.Load(stream);
var _rd = (from x in doc.Descendants("Cube")
where x.Attribute("currency").Value.Equals(SelectedCurrency.Instance.CurrencyCode)
select x).ToList();
Ofcause this kind of questions have been answered a lot of times before, but I can’t figure of if it has something to do with the duplication of the element names, cause all I get is a blank null.
Your problem is that you are not using namespaces for parsing the xml.
Something along these lines should work.