I need to walk or interact across all nodes and child nodes with VB.NET 200开发者_运维技巧8 and display thru debug.print.
Thanks.
Try it,
XmlDocument itemDoc = new XmlDocument();
itemDoc.Load("file.xml");
Console.WriteLine("DocumentElement has {0} children.",
itemDoc.DocumentElement.ChildNodes.Count);
foreach (XmlNode itemNode in itemDoc.DocumentElement.ChildNodes){
XmlElement itemElement = (XmlElement)itemNode;
Console.WriteLine("\n[Item]: {0}\n{1}",
itemElement.Attributes["name"].Value,
itemElement.Attributes["description"].Value);
if (itemNode.ChildNodes.Count == 0)
Console.WriteLine("(No additional Information)\n");
else
{
foreach (XmlNode childNode in itemNode.ChildNodes){
//
}
}
}
精彩评论