Hi,

From: Andreas Pinkert <the_supernova / gmx.net>
Subject: Problem with REXML
Date: Tue, 13 Aug 2002 05:48:42 +0900
Message-ID: <aj967j$4br$1 / piggy.rz.tu-ilmenau.de>

> doc.each_element("BOOK") {|book| puts book.element("AUTHOR") if 
>   "lala" == book.element("TITLE")}

What about this?

REXML::XPath.each(doc,"//AUTHOR[../TITLE/text()='lala']") do |author|
  puts author # This is "puts autor.text" if you want to get "hans".
end

> or, even better:
> 
> @element = Element.new()
> doc.each_element("BOOK") {|book| @element = book if 
>   "lala" == book.element("TITLE")}

And

REXML::XPath.each(doc,"//BOOK[TITLE/text()='lala']") do |book|
  @element = book
end

yours,

======================
SUTOU Kouhei
kou / cneti.net