I have some xml that represents a somewhat weirdly formed hash.
XmlSimple is eating some of my structure.
INPUT:
state
open
rate
daily
duration
monthly
XmlSimple.xml_in(xml, {‘ForceArray’=>false})
OUTPUT:
{“map”=> {
“time”=>[“daily”, “monthly”],
“key”=>[“state”, “rate”, “duration”],
“string”=>“open”
}
}
With the arrays folded that way, there’s no way for me to tell that
the value of “state” is “open”. I don’t really care about the
“datatypes”. I’m aiming at a single level hash something like this:
DESIRED:
{“map”=> {
“state” => "open,
“rate” => “daily”,
“duration” => “monthly”
}
}
I can’t really change the odd incoming XML, but I’m happy to process
any Ruby data structure that hasn’t lost some of my order/structure.
All of the options around folding appear to affect only attributes,
but I have only elements.