I'm playing with an imported XML file and using XMLDocument I'm wondering if there is a better way to do the same thing. Basically root contains MHZ nodes and each MHZ contains several devices and one name. I want to count every MHZ nodes and display the number of devices in each MHZ :
String xmlName = "tts.xml";
XmlDocument readDoc = new XmlDocument();
readDoc.Load(xmlName);
int fileNb = readDoc.SelectNodes("//MHZ").Count;
Console.WriteLine("MHZ number : "+fileNb);
for (int i = 0; i < fileNb; i++)
{
int deviceNb = readDoc.SelectNodes("//MHZ[" +(i+1)+ "]/device").Count;
Console.WriteLine(deviceNb);
}