I am looking for how to count the nodes in an XML file that contain No, as well as the total number of elements.
My element counter is working fine, but I'm not sure of the logic to look in the XML to calculate the value.
To get the total score that I use:
XmlDocument readDoc = new XmlDocument(); readDoc.Load(MapPath("Results.xml")); int count = readDoc.SelectNodes("root/User").Count; lblResults.Text = count.ToString();
Below is my XML:
<?xml version="1.0" encoding="iso-8859-1"?> <root> <User> <URL>http://www.example.com</URL> <JSEnabled>Yes</JSEnabled> </User> <User> <URL>http://www.example.com</URL> <JSEnabled>Yes</JSEnabled> </User> <User> <URL>http://www.example.com</URL> <JSEnabled>Yes</JSEnabled> </User> <User> <URL>http://www.example.com</URL> <JSEnabled>Yes</JSEnabled> </User> <User> <URL>http://www.example.com</URL> <JSEnabled>No</JSEnabled> </User>
source share