I am wondering if it is possible to count the number of elements in an XML document, it is desirable that it can use something similar to where (string)query.Attribute("attName") == att .
Using all my knowledge, I tried the following, but, unfortunately, I cannot get it to work.
var listElements = reader.Elements("shortlist"); foreach (var element in listElements) { XElement _xml; location.Position = 0; System.IO.StreamReader file = new System.IO.StreamReader(location); _xml = XElement.Parse(file.ReadToEnd()); XAttribute attName = _xml.Attribute("attN"); if (attName.Value == att) { Count++; } }
Thanks!
c # xml windows-phone-7 silverlight
Jamie
source share