From: John Lam Date: 2005-05-19T23:15:54+09:00 Subject: Idiomatic way for collecting elements using REXML? I'm writing some REST-ian code to talk to the Amazon Web Services since there are some bugs in SOAP4R (which I'll explain in a future mail). While manually parsing the XML that is returned from Amazon's REST interface, I wound up writing the following code: item.details = [] doc.elements.each('ItemLookupResponse/Items/Item') do |item| # construct an item_detail item_details << item_detail end This doesn't *feel* right. I wanted to use collect() but it's not implemented in REXML. Is there a more Ruby-esque approach to gathering some objects into an array while parsing XML? Thanks -John