RXML to HASH

basicaly i receive a xml response from the internet
and i would like to convert the xml structure into
an HASH object . Theres probably a lot of ways
to get this done but im curious to see if theres a gem
or RUBY way of doing this directly … thanks all. =]

On Mar 19, 2008, at 7:19 PM, a marc aurele wrote:

basicaly i receive a xml response from the internet
and i would like to convert the xml structure into
an HASH object . Theres probably a lot of ways
to get this done but im curious to see if theres a gem
or RUBY way of doing this directly … thanks all. =]

$ sudo gem install xml-simple

require ‘rubygems’
require ‘xmlsimple’
file = “/some/file.xml”
xml = XmlSimple.xml_in File.open(file).read, {‘KeepRoot’ => true}

Cheers-

  • Ezra Z.
    thanks. Do you know that i tried to do this by hand instead.
    im still bashing my head on the table … cyas

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs