[Rails] Re: How to deserialize an array from XML
On Mar 26, 1:24 pm, Gustavo de Sá Carvalho Honorato
<gustavohonor...@gmail.com> wrote:
> Hi,
>
> to serialize an array to xml we can use:
>
> an_array = [ 1, 2, 3]
> an_array.to_xml
>
> But to I can't find a way to convert back XML to array. I didn't find a
> method Array.from_xml like Hash.from_xml.
>
> Any ideas?
I have never done what you are trying but I know there is a way of
converting a hash to an array (http://ruby-doc.org/core/classes/
Hash.html#M000722) so you could do a double conversion. If you need a
simple array then you could just flatten the resulting array of
arrays.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home