I have a bunch of fields and when I try to run:
src.xpath('//RECORD').each do |record|
tbegin = record.xpath('//FIELD/TOKEN')
the tbegin
array returns the fields from other records. I've checked that the first line is giving me the appropriate array of "record" subtrees, but the next call for tbegin
doesn't limit the search to just the "record" subtree. In fact, it consistently returns the field subtree of record[0]
.
Thus far, I've gotten around this by using:
tbegin = record.css('TOKEN')
but I want to understand what I'm doing wrong.