Analysieren von XML-Ruby-Objekte und erstellen Attribut-Methoden dynamisch?

Muss ich parse eine XML-Datei in Ruby Objekte.

Gibt es ein tool zum Lesen von Attributen von XML, wie dies
report.system_slots.items gibt ein array von Element-Eigenschaften,
oder report.system_slots.current_usage Rückkehr 'zur Verfügung'?

Ist es möglich, dies zu tun mit Nokogiri?

<page Title="System Slots" H1="Property" H2="Value" __type__="2">
  <item Property="System Slot 1">
  <item Property="Name" Value="PCI1"/>
  <item Property="Type" Value="PCI"/>
  <item Property="Data Bus Width" Value="32 bits"/>
  <item Property="Current Usage" Value="Available"/>
  <item Property="Characteristics">
    <item Property="Vcc voltage supported" Value="3.3 V, 5.0 V"/>
    <item Property="Shared" Value="No"/>
    <item Property="PME Signal" Value="Yes"/>
    <item Property="Support Hot Plug" Value="No"/>
    <item Property="PCI slot supports SMBus signal" Value="Yes"/>
  </item>
</item>
InformationsquelleAutor azaytc | 2013-04-15
Schreibe einen Kommentar