J
John Lam
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 =3D []
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
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 =3D []
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