Very nice! Thank you. I'm sure I will be using this. But what about elements with attributes, nested elements AND/OR text values?
What does: <element attribute="blah">text</element> Look like? And what does a nested structure like this look like as a hash: <elements groupName="blah"> <element id="1" type="blah1">text1</element> <element id="2" type="blah2">text2</element> </elements> I would expect something similar to... { elements: [ { groupName: "blah", element: [ { id: "1", type: "blah1", TEXT: "text1" // ??? }, { id: "2", type: "blah2", TEXT: "text2" // ??? } ] } ] } ...but you'll have to have some way to handle cases where an attribute of "TEXT" is supplied, etc... ...you might have to append your hash object names with something to indicate if the name/value pair represents an attribute, element, or text node. Like: { elements_EL: [ { groupName_ATTR: "blah", element_EL: [ { id_ATTR: "1", type_ATTR: "blah1", text: "text1" }, { id_ATTR: "2", type_ATTR: "blah2", text: "text2" } ] } ] } Then you always know "text" represents the text value, because if an element (or attribute) of "text" was supplied, it would be appended with an identifier.. Or maybe taking it that far is beyond the scope of what you need it for? Lol, it seems if you take this far enough you might as well just stick with XML... The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs