From: SUTOU Kouhei Date: 2002-08-13T13:27:57+09:00 Subject: Re: Problem with REXML Hi, From: Andreas Pinkert Subject: Problem with REXML Date: Tue, 13 Aug 2002 05:48:42 +0900 Message-ID: > 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