Introducing the Kvx gem
Reading a Hash object
require 'kvx'
kvx = Kvx.new({:fun => '123', :apple => 'red'})
puts kvx.to_xml
Output:
<?xml version='1.0' encoding='UTF-8'?> <kvx> <fun>123</fun> <apple>red</apple> </kvx>
s =<<EOF
<kvx>
<fun>123</fun>
<apple>red</apple>
</kvx>
EOF
h = Kvx.new(Rexle.new(s).root).to_h
#=> {"kvx"=>{"fun"=>"123", "apple"=>"red"}}
Resource
kvx gem