A lot has been written about Nokogiri in terms of reading XML using
XPath. However, what’s about using Nokogiri with XML containing XPath
In the example, the xml contains a XPath reference:... ...
Since both location elements are equal, only the first element is
described in detail. The second just references the first.
Using Nokogiri, xml.xpath(’//location’) returns two node instances as
expected. The first node contains all child nodes. The second only a
reference as an attribute of the second node instance.
Ok, assuming I want to request all longitude values, I would do
xml.xpath(’//location/longitude’). This returns only one node instance.
However, since there are actually two elements of type “longitude”, I
expected to receive two node instances, expecting Nokogiri to resolve
How do I achieve this with Nokogiri?