From: Charles Sword Date: 2007-11-11T04:37:32+09:00 Subject: Re: REXML parsing issue 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: > > url=REXML::XPath.each(doc, '//HIT/FIELD[ "url" = @NAME ]').text > {|element|} > > I'm getting a 'no code block given' error but I thought this should pass > each element back to the array url? > > Thanks in advance for any further help. > > charles > > > Phlip wrote: >> Charles Sword wrote: >> >>> 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. -- Posted via http://www.ruby-forum.com/.