开发者

Querying XML doc with Excel VBA

开发者 https://www.devze.com 2023-01-25 04:25 出处:网络
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\']\")

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 n开发者_运维知识库odeList 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?


Alejandro, thank you! It seems like

curNode.Selectnodes("child::*")

does the trick!

0

精彩评论

暂无评论...
验证码 换一张
取 消