mtelis
mtelis

Reputation: 674

Querying XML doc with Excel VBA

I'm building a list of nodes I need to load from XML document using SelectNodes(xpath):

Set oNodeList = xmldoc.selectNodes("//Object/Property[@Name='Group' and Value='True']")

and looping thru the nodes:

For Each curNode In oNodeList
  Set nAttr = curNode.parentNode.Attributes
  If (nAttr.getNamedItem("Seq").nodeValue = "abc") Then
'  additional processing
  End If
Next

Additional processing involves looping thru child nodes of curNode. I was wondering if it's possible in build yet another nodeList using selectNodes which would select child nodes of curNode that meet particular criteria. The key point that xpath should start looking from the current node.

How can I do that?

Upvotes: 0

Views: 2172

Answers (1)

mtelis
mtelis

Reputation: 674

Alejandro, thank you! It seems like

curNode.Selectnodes("child::*")

does the trick!

Upvotes: 1

Related Questions