In this example I'd like to return the value (Sample Text)for the <FIELD
NAME="title"> tag? So my question is how do I specify this attribute to
either a tree or stream parser?
In this example I'd like to return the value (Sample Text)for the <FIELD
NAME="title"> tag? So my question is how do I specify this attribute to
either a tree or stream parser?
Use XPath:
title = REXML::XPath.first(doc, '/HIT/FIELD[ "title" = @name ]').text
Look up my assert_xpath project for more XPath scenarios.
Thanks Phlip. That allowed me to get to the first instance in each
document but I'm struggling with populating an array with XPath.each?
Here's the statement I'm using:
Disregard previous post. I was able to work through how to iterate
through the rest of the document.
Thanks again for your help.
Charles Sword wrote:
···
Thanks Phlip. That allowed me to get to the first instance in each
document but I'm struggling with populating an array with XPath.each?
Here's the statement I'm using: