Tuesday, March 20, 2012

Ruby hash to_xml residue

When using the to_xml on a ruby hash object, it leaves a root.
The way to get rid of it is by explicitly specifying the root by the following:


my_hash_object = {:a=>"a", :b=>"b"}
result = my_hash_object.to_xml(:root=>"new_root")

And that's what its all about.

No comments:

Post a Comment

Please do not post spam on this blog, Spam sites will be reported to google.
thank you kindly.