title: Convert XML collection (of Pivotal Tracker stories) to Ruby hash/object
body: <p>I have a collection of stories in an XML format. I would like to parse the file and return each story as either hash or Ruby object, so that I can further manipulate the data within a Ruby script.</p>
  
  <p>Does <a href="http://nokogiri.org" rel="nofollow noreferrer">Nokogiri</a> support this, or is there a better tool/library to use?</p>
  
  <p>The XML document has the following structure, returned via <a href="http://www.pivotaltracker.com/help/api" rel="nofollow noreferrer">Pivotal Tracker's web API</a>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;stories type="array" count="145" total="145"&gt;
    &lt;story&gt;
      &lt;id type="integer"&gt;16376&lt;/id&gt;
      &lt;story_type&gt;feature&lt;/story_type&gt;
      &lt;url&gt;http://www.pivotaltracker.com/story/show/16376&lt;/url&gt;
      &lt;estimate type="integer"&gt;2&lt;/estimate&gt;
      &lt;current_state&gt;accepted&lt;/current_state&gt;
      &lt;description&gt;A description&lt;/description&gt;
      &lt;name&gt;Receivable index listing will allow selection viewing&lt;/name&gt;
      &lt;requested_by&gt;Tony Superman&lt;/requested_by&gt;
      &lt;owned_by&gt;Tony Superman&lt;/owned_by&gt;
      &lt;created_at type="datetime"&gt;2009/11/04 15:49:43 WST&lt;/created_at&gt;
      &lt;accepted_at type="datetime"&gt;2009/11/10 11:06:16 WST&lt;/accepted_at&gt;
      &lt;labels&gt;index ui,receivables&lt;/labels&gt;
    &lt;/story&gt;
    &lt;story&gt;
      &lt;id type="integer"&gt;17427&lt;/id&gt;
      &lt;story_type&gt;feature&lt;/story_type&gt;
      &lt;url&gt;http://www.pivotaltracker.com/story/show/17427&lt;/url&gt;
      &lt;estimate type="integer"&gt;3&lt;/estimate&gt;
      &lt;current_state&gt;unscheduled&lt;/current_state&gt;
      &lt;description&gt;&lt;/description&gt;
      &lt;name&gt;Validations in wizards based on direction&lt;/name&gt;
      &lt;requested_by&gt;Matthew McBoggle&lt;/requested_by&gt;
      &lt;created_at type="datetime"&gt;2009/11/17 15:52:06 WST&lt;/created_at&gt;
    &lt;/story&gt;
    &lt;story&gt;
      &lt;id type="integer"&gt;17426&lt;/id&gt;
      &lt;story_type&gt;feature&lt;/story_type&gt;
      &lt;url&gt;http://www.pivotaltracker.com/story/show/17426&lt;/url&gt;
      &lt;estimate type="integer"&gt;2&lt;/estimate&gt;
      &lt;current_state&gt;unscheduled&lt;/current_state&gt;
      &lt;description&gt;Manual payment needs a description field.&lt;/description&gt;
      &lt;name&gt;Add description to manual payment&lt;/name&gt;
      &lt;requested_by&gt;Tony Superman&lt;/requested_by&gt;
      &lt;created_at type="datetime"&gt;2009/11/17 15:10:41 WST&lt;/created_at&gt;
      &lt;labels&gt;payment process&lt;/labels&gt;
    &lt;/story&gt;
    &lt;story&gt;
      &lt;id type="integer"&gt;17636&lt;/id&gt;
      &lt;story_type&gt;feature&lt;/story_type&gt;
      &lt;url&gt;http://www.pivotaltracker.com/story/show/17636&lt;/url&gt;
      &lt;estimate type="integer"&gt;3&lt;/estimate&gt;
      &lt;current_state&gt;unscheduled&lt;/current_state&gt;
      &lt;description&gt;The SMS and email templates needs to be editable by merchants.&lt;/description&gt;
      &lt;name&gt;Notifications are editable by the merchant&lt;/name&gt;
      &lt;requested_by&gt;Matthew McBoggle&lt;/requested_by&gt;
      &lt;created_at type="datetime"&gt;2009/11/19 16:44:08 WST&lt;/created_at&gt;
    &lt;/story&gt;
  &lt;/stories&gt;
  </code></pre>