XmlDocument xdXml = new XmlDocument();
xdXml.Load("Index.xml");
Make a nodelist
XmlNodeList xnNodes = xdXml.SelectNodes("/Tools/Download");
Walk through the list
foreach (XmlNode node in xnNodes)
{
if (node.FirstChild.InnerText == ddlTools.Text)
{
//Get all the child nodes
XmlNodeList childNodes = node.ChildNodes;
//And walk through them
foreach (XmlNode child in childNodes)
{
//Check which node we have now
switch (child.Name)
{
case "Name":
txtName.Text = child.InnerText;
break;
case "Version":
txtVersion.Text = child.InnerText;
break;
case "Category":
txtCategory.Text = child.InnerText;
break;
case "Description":
txtDescription.Text = child.InnerText;
break;
}
}
childNodes = null;
break;
}
}
Clean up
xdXml = null;
xnNodes = null;
0 comments:
Post a Comment