# RXML to HASH

**URL:** <https://www.ruby-forum.com/t/rxml-to-hash/132428>\
**Category:** Ruby\
**Created:** [March 20, 2008, 3:20am UTC](https://www.ruby-forum.com/t/rxml-to-hash/132428 "2008-03-20T03:20:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a\_marc\_aurele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7993a0/32.png) [@a\_marc\_aurele](https://www.ruby-forum.com/u/a_marc_aurele)\
**Post date:** [March 20, 2008, 3:20am UTC](https://www.ruby-forum.com/t/rxml-to-hash/132428/1 "2008-03-20T03:20:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![a\_marc\_aurele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7993a0/32.png) [@a\_marc\_aurele](https://www.ruby-forum.com/u/a_marc_aurele)\
**Post date:** [March 20, 2008, 3:28am UTC](https://www.ruby-forum.com/t/rxml-to-hash/132428/2 "2008-03-20T03:28:27Z")

</div>

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.  
– Founder & Software Architect  
– removed\_email\_address@domain.invalid  
– [EngineYard.com](http://EngineYard.com)

---

<div class="post-metadata">

**Author:** ![a\_marc\_aurele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7993a0/32.png) [@a\_marc\_aurele](https://www.ruby-forum.com/u/a_marc_aurele)\
**Post date:** [March 21, 2008, 12:50am UTC](https://www.ruby-forum.com/t/rxml-to-hash/132428/3 "2008-03-21T00:50:52Z")

</div>

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