Given (no comments about the XML naming necessary):
<config>
<unit>
<var name='model'>3100</var>
<var name='type'>production</var>
</unit>
<unit>
<var name='model'>0100</var>
<var name='type'>test</var>
</unit>
</config>
How can I construct an XPATH to select the node with the attribute "model" and the text 3100 using Ruby Nokogiri
I'm trying:
//var[@name='model' and text()='3100']
but getting "invalid predicate". Obviously that's just the XPATH with the Nokogiri calls omitted. I don't seem to be having an开发者_如何转开发y problems with the Nokogiri usage, so my request is just about fixing the XPATH.
That works with nokogiri 1.5, Are you using a very old version?
精彩评论