From: Phlip Date: 2007-11-11T00:15:00+09:00 Subject: Re: REXML parsing issue Charles Sword wrote: > I've used REXML to write both tree and stream parsers for simple xml > files but I can't seem to return values for the xml below in either > case: > > > Sample Text > > > In this example I'd like to return the value (Sample Text)for the 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. -- Phlip