ruby - How to select an element using Nokogiri -


given following xml, want value "0123456" name="cat":

xml.xpath '//custom[name="cat"]' 

gives me first custom, correct, want "value" not entire custom node.

<body>   <custom>     <count>1</count>     <name>cat</name>     <value>0123456</value>   </custom>   <custom>     <count>2</count>     <name>dog</name>     <value>9876543</value>   </custom> <body> 

i want "value" not entire custom node.

so go on writing path:

//custom[name="cat"]/value 

Comments