On Fri, 21 Jan 2005 15:21:45 +0900, Luke Galea <lgalea / gmmsolutions.com> wrote: > Hi all, > > curious if there is a nice ruby way to express an xpath like navigation of an > object graph.. > > ie: > > XPATH way: > Countries/Provinces/Cities[ @name = "London" ] > > versus > > The only Ruby way I can think of: > countries.collect{ |c| c.provinces.collect {|p| p.cities.select { |c2| c2#name > == 'London' } } } > > Thanks in advance > > I asked a similar question a couple of weeks ago, and there was nothing existing in the ruby world from the looks of it. http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/125206 Some external projects to look at mentioned: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/125284 A code idea: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/125291 JXpath in the Java world seems like it's for exactly this purpose. http://jakarta.apache.org/commons/jxpath/ I haven't worked on the query aspect of my project lately, so I haven't made up my mind how I'm going to approach it yet. Regards, Nick -- Nicholas Van Weerdenburg