Here is the way I do it. I test it with your XML and it is working
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("pagedata.xml"
XmlNode root = xmldoc.DocumentElement;
try
{
XmlNode xnode = root.SelectSingleNode("/ro
for (int i=0; i< xnode.ChildNodes.Count; i++)
{
MessageBox.Show(xnode.Chil
}
The XPath Query you specified is correct but your for loop is wrong. you need to loop through the childNodes and get the attribute value not the node value since in your case you are storing the data in the attributes not the nodes.
Don't forget to "Accept My Answer" if my response was of help
Main Topics
Browse All Topics





by: naveenkohliPosted on 2003-03-28 at 13:59:15ID: 8228101
Use InnerText property instead of Value property. This will work if all your nodes are element types and your values are not set as attributes of these nodes.