I am looking for how to count the nodes in an XML file that contain a value of \"No\" as well as the total number of elements.
I have the element count working fine,
XmlDocument readDoc = new XmlDocument();
readDoc.Load(MapPath("Results.xml"));
int count = readDoc.SelectNodes("root/User").Count;
lblResults.Text = count.ToString();
int NoCount = readDoc.SelectNodes("JSEnabled[. = \"No\"]").Count;
Good reference here: http://msdn.microsoft.com/en-us/library/ms256086.aspx
I am looking for how to count the nodes in an XML file that contain a value of "No"
In XPath:
count(/root/User[JSEnabled = 'No'])
as well as the total number of elements.
That you already have it:
count(/root/User)
Or use the expression for selecting the nodes and any DOM method to count Node Set Result members.