From: Trans Date: 2006-08-06T13:11:57+09:00 Subject: Re: magic/xml library for easy XML processing Zed Shaw wrote: > On Sat, 2006-08-05 at 10:17 +0900, Tomasz Wegrzanowski wrote: > > Hello, > > > > Some of you may be interested in a new library for XML processing. > > It is inspired by languages designed just for XML-processing like CDuce > > and to some extend by Perl's XML::Twig. Basically easy things > > should be easy, and everything should be integrated very tightly > > with Ruby. > > > > doc = XML.from_url "http://t-a-w.blogspot.com/atom.xml" > > doc.children(:entry).children(:link) {|c| > > print "#{c[:title]}\n#{c[:href]}\n\n" if c[:rel] == "alternate" > > } > > > > I'd like to have it work like Hpricot as well: > > (doc/:entry/:link).each do {|c| > ... > } > > Especially considering you overload [] to get attributes, why not / to > get children? http://cherry.rubyforge.org http://rubyforge.org/projects/cherry/ T.