Ich habe eine Sammlung von Geschichten in einem XML-Format. Ich möchte die Datei analysieren und jede Geschichte entweder als Hash oder Ruby-Objekt zurückgeben, so dass ich die Daten in einem Ruby-Skript weiter bearbeiten kann.
Hat Nokogiri unterstützen, oder gibt es ein besseres Werkzeug/eine bessere Bibliothek, die man verwenden kann?
Das XML-Dokument hat die folgende Struktur und wird über Die Web-API von Pivotal Tracker :
<?xml version="1.0" encoding="UTF-8"?>
<stories type="array" count="145" total="145">
<story>
<id type="integer">16376</id>
<story_type>feature</story_type>
<url>http://www.pivotaltracker.com/story/show/16376</url>
<estimate type="integer">2</estimate>
<current_state>accepted</current_state>
<description>A description</description>
<name>Receivable index listing will allow selection viewing</name>
<requested_by>Tony Superman</requested_by>
<owned_by>Tony Superman</owned_by>
<created_at type="datetime">2009/11/04 15:49:43 WST</created_at>
<accepted_at type="datetime">2009/11/10 11:06:16 WST</accepted_at>
<labels>index ui,receivables</labels>
</story>
<story>
<id type="integer">17427</id>
<story_type>feature</story_type>
<url>http://www.pivotaltracker.com/story/show/17427</url>
<estimate type="integer">3</estimate>
<current_state>unscheduled</current_state>
<description></description>
<name>Validations in wizards based on direction</name>
<requested_by>Matthew McBoggle</requested_by>
<created_at type="datetime">2009/11/17 15:52:06 WST</created_at>
</story>
<story>
<id type="integer">17426</id>
<story_type>feature</story_type>
<url>http://www.pivotaltracker.com/story/show/17426</url>
<estimate type="integer">2</estimate>
<current_state>unscheduled</current_state>
<description>Manual payment needs a description field.</description>
<name>Add description to manual payment</name>
<requested_by>Tony Superman</requested_by>
<created_at type="datetime">2009/11/17 15:10:41 WST</created_at>
<labels>payment process</labels>
</story>
<story>
<id type="integer">17636</id>
<story_type>feature</story_type>
<url>http://www.pivotaltracker.com/story/show/17636</url>
<estimate type="integer">3</estimate>
<current_state>unscheduled</current_state>
<description>The SMS and email templates needs to be editable by merchants.</description>
<name>Notifications are editable by the merchant</name>
<requested_by>Matthew McBoggle</requested_by>
<created_at type="datetime">2009/11/19 16:44:08 WST</created_at>
</story>
</stories>