June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to iterate through all nodes in an XML tree and display or modify the related information.
Create a generic procedure for processing the node, and call it recursively.
The XmlDocument stores a tree of XmlNode objects. You can walk through this tree structure recursively to process every node.
For example, consider the following code, which displays information about every node in a document. A depth parameter tracks how many layers deep the nesting is and uses it to format the output with a variable-sized indent.
Public Module XmlOuputTest Public Sub Main() ' Load the document. Dim Doc As New XmlDocument Doc.Load("orders.xml") ' Start the node walk at the root node (depth = 0). DisplayNode(Doc.DocumentElement, ...Read now
Unlock full access