gpt4 book ai didi

xpath - 切换到XML 6时selectSingleNode的xpath问题

转载 作者:行者123 更新时间:2023-12-03 16:53:21 25 4
gpt4 key购买 nike

这是我的XML:

<?xml version="1.0"?>
<Revision>
<Revision Index="1"/>
</Revision>


使用 DomDocument(ver 3)时,我可以运行以下命令(在VB6中):

Set objNode = objDom.documentElement.selectSingleNode("//.[@Index = '1']")


这是为了识别此属性及其值是否存在。

现在,移到 DomDocument60(ver 6)之后,此行将失败。

我应该如何重写它以便与 DomDocument60一起使用?

提前致谢
多伦

最佳答案

您可以尝试使用XPath:

//Revision[@Index="1"]


这将选择文档中所有具有属性 RevisionIndex="1"节点。

关于xpath - 切换到XML 6时selectSingleNode的xpath问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33198741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com