I'm using Nokogiri to parse some XML that looks kind of like:
<item name="item one">
<other name="other name"/>
<third />
</item>
<item name="item two">
<other />
<third />
</item>
I'm parsing over the items using Nokogiri like so:
xmldoc.xpath("//item").each do |node|
node.xpath("//*[@name]") # Gives me *all* elements in the doc
node.xpath(".//*[@name]") # Gives me child elements of the item
end
What expression can I use to get [item, other]
from the first node as I iterate through?