What is the fastest, one-liner/shortest way to get an Array of "strings/that/are/paths" from an XML file, using Nokogiri preferably. I'd like to build the array with an arbitrary attribute name ('id' in this case), but also knowing how to do it for the element name would be helpful.
So this:
<root id="top">
<nodeA id="almost_top">
<nodeB id="a_parent">
<nodeC id="im_a_node"/>
<nodeD id="child_node"/>
</nodeB>
<nodeB id="child"/>
</nodeA>
</root>
to this:
[
"top",
"top/almost_top",
"top/almost_top/a_parent",
"top/almost_top/a_parent/im_a_node",
"top/almost_top/a_parent/child_node",
"top/almost_top/child"
]
Thanks so much.