Nokogiri xpath() 'or'运算符?



我是否可以使用Nokogiri的xpath()来完成以下任务?

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

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

试试这个XPath:

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

这也适用于我:

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

返回NodeSet

我得到了这样的代码:

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

返回true而不是NodeSet

最新更新