I have a very large OData XML document I'm parsing with Ruby and Nokogiri. There are multiple nodes with sub-nodes for enumerations that I want to pull into a hash.
I'm correctly finding and iterating over these nodes using:
data_xml.xpath('//Schema/EnumType').each do |enumerations|
enumerations.xpath('//Annotation/@String').each do |enum|
# add to my hash
I assumed by doing the second, nested, XPath search on the enumerations
node set it'd only iterate over this specific node set, but the hash has every single annotation in the document, not just the ones in the node set.
Am I doing something wrong or is there a different way to apply XPath only to that sub-set?