本文介绍了使用Excel VBA查询XML文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在构建需要使用SelectNodes(xpath)从XML文档加载的节点列表:
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']")
并遍历节点:
For Each curNode In oNodeList
Set nAttr = curNode.parentNode.Attributes
If (nAttr.getNamedItem("Seq").nodeValue = "abc") Then
' additional processing
End If
Next
其他处理涉及循环遍历curNode的子节点.我想知道是否有可能使用selectNodes构建另一个nodeList,它将选择满足特定条件的curNode的子节点.xpath应该从当前节点开始寻找的关键点.
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.
我该怎么做?
推荐答案
亚历杭德罗,谢谢!好像
Alejandro, thank you! It seems like
curNode.Selectnodes("child::*")
做到了!
这篇关于使用Excel VBA查询XML文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!