|
Re: Problem with REXML: msg#01174lang.ruby.general
Hi, From: Andreas Pinkert <the_supernova@xxxxxxx> Subject: Problem with REXML Date: Tue, 13 Aug 2002 05:48:42 +0900 Message-ID: <aj967j$4br$1@xxxxxxxxxxxxxxxxxxxxxx> > 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@xxxxxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: class === class often false?, dblack |
|---|---|
| Next by Date: | Re: Perl calling C calling Ruby (linking problem), nobu . nokada |
| Previous by Thread: | Re: Problem with REXML, Tobias Reif |
| Next by Thread: | Re: Problem with REXML, Andreas Pinkert |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |