【发布时间】:2015-06-27 21:38:37
【问题描述】:
示例 XML
<catalog>
<book id="Adventure" Type="Hardcover">
<other>
<author name="Jones" id="Adventure">
</author>
</other>
</book>
</catalog>
这些说法有意义吗?我需要进行完整性检查以查看所有这些变量/引用的情况。我尝试使用其中一个 XPath 测试站点,但它一直给我一个错误,我不知道为什么。
bookVar = "Adventure"
bookStyle = "Hardcover"
bookAuthor = "Jon"
Set my_location = XMLFile.SelectNodes("/catalog/book[@id=""" & bookVar & """]/author/other/*[contains(name(),""" & bookAuthor & """]")
Set my_location2 = XMLFile.SelectNodes("/catalog/book[@id=""" & bookVar & """ and Type=""" & bookStyle &"""]
Set my_location3 = XMLFile.SelectNodes("/catalog/book[@id=""" & bookVar & """]/other/author/*[contains(name(),""" & bookAuthor & """]")
【问题讨论】:
标签: xml vba dom xpath xml-parsing