The trick with XmlSimple is that it can round-trip. In other words,
you can perform xml_in() on the output you want and you’ll see exactly
what you need for xml_out() to produce it.
so, you can do this:
require ‘xmlsimple’
data = ‘
333
’
xml = XmlSimple::xml_in(data, {“KeepRoot” => true})
P.S. I hadn’t used XmlSimple before, but the docs on the xml_out
method say “If the resulting XML is parsed using xml_in, it will
return a data structure equivalent to the original.” so I realized the
above trick would work.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.