How can I get the values of two nodes if they have the same name, using LibXML for Ruby, or any other Ruby library? I have this XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<test>
<test1>
<foo>534569</foo>
</test1>
<test1>
<foo>534570</foo>
</test1>
</test>
I want both values of foo.
You can use the
findmethod, which will return all nodes that match the specified xpath.Below is an example of how to output the content of each foo element: