tags:

views:

1401

answers:

1

Hi

how to navigate the XML file and get all a list of nodes in order to access their attributes and count no of nodes in Student tag.

for example :

Can anybody briefy me .how to do ? give any sample code to do so.?

Thanks & Regards

Ravi Kumar

A: 

You can get a collection of XmlNodes from and XmlDocument like this

XmlNodeList nodes = document.GetElementsByTagName("MyNodeName");
foreach (XmlNode node in nodes)
{
    // do stuff with each node
}

The XmlNode class has an Attributes property which is a collection of attributes. You can iterate through them and match the attributes you are looking for.

Ed Swangren