help
Hi, everyone,
I have a hash obj and when converted to xml using to_xml the
tag appears like the following
I want to get rid of that so that it is just
<?xml version="1.0" encoding="UTF-8"?> ...Please help. Thank you,
Song,
Hi, everyone,
I have a hash obj and when converted to xml using to_xml the
tag appears like the following
I want to get rid of that so that it is just
<?xml version="1.0" encoding="UTF-8"?> ...Please help. Thank you,
Song,
On Apr 28, 8:34 pm, Song C. [email protected] wrote:
I want to get rid of that so that it is just
<?xml version="1.0" encoding="UTF-8"?> ..
Since you want the xml declaration, I assume you want a valid XML
document. A valid XML document must have exactly one root element. You
cannot remove the root, because then if your hash had more than one
entry it would produce multiple roots and thus invalid XML.
You can change the name of the element, however:
hash.to_xml({:root => ‘steps’})
– Mark.
Thank you!!!
THis helps!!
Song,
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs