To_xml and from_xml round robin ... exists?

Im creating an api for my website and Im trying to roll my own.
I know I can use activeresource and some other packages, but really what
I would like is to be able to send simple xml data back and forth.

Im sticking with AR controllers since I use the respond_to block to
output results in amf (via RubyAMF) and xml. So for the respond_to xml
code, I want to be able to do

{}.to_xml and get something that can be translated back equivalently. on
the other end.

Right now, if I want to get and array from xml, I have to send xml like:
“1234” to get params[:ids]
and if its only “1”, then params[:ids] is not an array.

I know Rails 2.0 is trying to make a better AR#to_xml function, but that
doesnt aim at my use case.

Also something like [{:foo => [“bar”,“bar”,“bar”]}].to_xml will throw an
error as well.

Somebody has had to have written a mirroring to_xml / from_xml function
by this point.

Can anyone point me in the right direction?

On 16 Feb 2008, at 00:49, Aryk G. wrote:

{}.to_xml and get something that can be translated back
doesnt aim at my use case.

Also something like [{:foo => [“bar”,“bar”,“bar”]}].to_xml will
throw an
error as well.

Somebody has had to have written a mirroring to_xml / from_xml
function
by this point.

Hash.from_xml ?

Fred