Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: xmlsimple: prevent folding multiple elements into array?
Brian Candler
7/17/2007 10:10:00 AM
> I have some xml that represents a somewhat weirdly formed hash.
> XmlSimple is eating some of my structure.
Try this:
xml = <<INPUT
<kern>
<map>
<key>
state
</key>
<string>
open
</string>
<key>
rate
</key>
<time>
daily
</time>
<key>
duration
</key>
<time>
monthly
</time>
</map>
</kern>
INPUT
# See
http://www.germane-software.com/software/rexml/docs/tut...
require 'rexml/document'
doc = REXML::Document.new(xml)
doc.elements.each("/kern/map/*") do |element|
puts element.name, element.text.strip
end
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: xmlsimple: prevent folding multiple elements into array?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password