From: Kouhei Sutou (=?iso-2022-jp?B?GyRCP1xGIzh5Sj8bKEI=?=) Date: 2003-01-11T01:19:16+09:00 Subject: Re: REXML and XPath Confusion From: Mark Probert Subject: Re: REXML and XPath Confusion Date: Sat, 11 Jan 2003 00:03:37 +0900 Message-ID: <5.1.0.14.2.20030110095500.00b2eb98@zcard04k.ca.nortel.com> > panels = XPath.match( doc, "//panel/attribute::name" ) > > Appears to return an array of strings. When I do "panels.each" > it seems to be just strings. Really? How about using Object#class? # I wrote in [ruby-talk:61021] ;-) panels.each do |panel| p panel.class end > When I do "p panels" it doesn't > appear to be strings. When you use puts you look REXML::Attribute#to_s. When you use p you look REXML::Attribute#inspect. Both are String. > And I can't match against strings. You can get a unnormalized attribute value as String by using REXML::Attribute#value. You can get a normalized attribute value as String by using REXML::Attribute#to_s. Regards, kou