title: Converting xml into a native Ruby data structure
body: <p>I'm grabbing data from an api that is returning xml like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;seriess realtime_start="2013-01-28" realtime_end="2013-01-28"&gt; &lt;series id="GDPC1" realtime_start="2013-01-28" realtime_end="2013-01-28" title="Real Gross Domestic Product, 1 Decimal" observation_start="1947-01-01" observation_end="2012-07-01" frequency="Quarterly" frequency_short="Q" units="Billions of Chained 2005 Dollars" units_short="Bil. of Chn. 2005 $" seasonal_adjustment="Seasonally Adjusted Annual Rate" seasonal_adjustment_short="SAAR" last_updated="2012-12-20 08:16:28-06" popularity="93" notes="Real gross domestic product is the inflation adjusted value of the goods and services produced by labor and property located in the United States. For more information see the Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)"/&gt; &lt;/seriess&gt;
  </code></pre>
  
  <p>I'm new to deserialization but what I think is appropriate is to parse this xml into a ruby object that I can then reference like objectFoo.seriess.series.frequency that would return 'Quarterly'.</p>
  
  <p>From my searches here and on google there doesn't seem to be an obvious solution to this in Ruby (NOT rails) which makes me think I'm missing something rather obvious. Any ideas?</p>
  
  <p><strong>Edit</strong>
  I setup a test case based upon Winfield's suggestion.</p>
  
  <pre><code>class Exopenstruct
  
    require 'ostruct'
  
    def initialize()  
  
    hash = {"seriess"=&gt;{"realtime_start"=&gt;"2013-02-01", "realtime_end"=&gt;"2013-02-01", "series"=&gt;{"id"=&gt;"GDPC1", "realtime_start"=&gt;"2013-02-01", "realtime_end"=&gt;"2013-02-01", "title"=&gt;"Real Gross Domestic Product, 1 Decimal", "observation_start"=&gt;"1947-01-01", "observation_end"=&gt;"2012-10-01", "frequency"=&gt;"Quarterly", "frequency_short"=&gt;"Q", "units"=&gt;"Billions of Chained 2005 Dollars", "units_short"=&gt;"Bil. of Chn. 2005 $", "seasonal_adjustment"=&gt;"Seasonally Adjusted Annual Rate", "seasonal_adjustment_short"=&gt;"SAAR", "last_updated"=&gt;"2013-01-30 07:46:54-06", "popularity"=&gt;"93", "notes"=&gt;"Real gross domestic product is the inflation adjusted value of the goods and services produced by labor and property located in the United States.\n\nFor more information see the Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)"}}}
  
    object_instance = OpenStruct.new( hash )
  
    end
  end
  </code></pre>
  
  <p>In irb I loaded the rb file and instantiated the class.  However, when I tried to access an attribute (e.g. instance.seriess) I received: NoMethodError: undefined method `seriess'</p>
  
  <p>Again apologies if I'm missing something obvious.</p>