tags:

views:

68

answers:

1

Hi

I need to walk or interact across all nodes and child nodes with VB.NET 2008 and display thru debug.print.

Thanks.

+1  A: 

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){
           // 
        }               
    }
}
adatapost