Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将 Nokogiri 1.3.3 与 Ruby 1.8.7 一起使用,我正在尝试匹配此 SO 问题中描述的标签内容:
nodeset.xpath("entry/index[. = '#{index.to_s}']/../categories")
Nokogiri 提出了一个异常,抱怨.括号后的 ' '。当我.用它替换 ' 'text()然后抱怨第二个时期。这是我还是Nokogiri?我如何解决它
.
text()
如果我正确理解您的文档结构,您应该能够:
nodeset.xpath("entry[index='#{index.to_s}']/categories")
这对我来说似乎更具可读性。