Nokogiri xpath() '或'操作员?

发布于 2024-12-21 09:25:54 字数 127 浏览 4 评论 0原文

有没有办法使用 Nokogiri 的 xpath() 完成以下任务?

doc.xpath("//pod[@id=or('anid','anotherid')]")

Is there a way I can accomplish the following using Nokogiri's xpath() ?

doc.xpath("//pod[@id=or('anid','anotherid')]")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一城柳絮吹成雪 2024-12-28 09:25:54

尝试 doc.xpath("//pod[@id='anid' 或 @id='anotherid']")

Try doc.xpath("//pod[@id='anid' or @id='anotherid']")

冬天的雪花 2024-12-28 09:25:54

试试这个 XPath:

doc.xpath("//pod[@id='anid' or @id='anotherid']")

Try this XPath:

doc.xpath("//pod[@id='anid' or @id='anotherid']")
冰葑 2024-12-28 09:25:54

这也对我有用:

sect_pr.xpath("//pod[@id='anid']", "//pod[@id='anotherid']")

它返回 NodeSet

我得到这样的代码:

sect_pr.xpath('//w:headerReference or //w:footerReference')

它返回 true insted NodeSet

This also worked for me:

sect_pr.xpath("//pod[@id='anid']", "//pod[@id='anotherid']")

It returns NodeSet

I got code like this:

sect_pr.xpath('//w:headerReference or //w:footerReference')

And it return true insted NodeSet

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文