[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RXML to HASH

a marc aurele

3/20/2008 2:17:00 AM

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. =]



2 Answers

Ezra Zygmuntowicz

3/20/2008 2:27:00 AM

0


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 Zygmuntowicz
-- Founder & Software Architect
-- ezra@engineyard.com
-- EngineYard.com


a marc aurele

3/20/2008 11:47:00 PM

0


>
> $ 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 Zygmuntowicz

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