June 18th, 2012, 01:41 PM
How to get all descendant nodes when reading XML?
I am trying to figure out how to obtain all the descendant nodes for a particular node - is there a property or a method available?
Here's what I mean:
In above example, say I am at node1 (i.e. I know the name of this node so can obtain the node object) but what I am after is knowing all the descendants of node 1 i.e. node2, node3, and node4 - is there a way to do this?
Thanks for help!
June 18th, 2012, 05:07 PM
I was able to get this using recursion...but that doesn't solve my problems completely, I think (not sure as I need to experiment more). FYI, here's the code:
sMsg = sMsg & xmlnode.nodeName & vbCrLf
If xmlnode.hasChildNodes Then
For Each xmlchild In xmlnode.childNodes