I'm using XmlSimple to turn an XML document into a ruby hash. It turns data like this:
<resultPage>
<total>2</total>
<offset>0</offset>
<limit>200</limit>
</resultPage>
Into this:
{ :resultPage => [
{
:offset => [ "0" ],
:total => [ "2" ],
:limit => [ "200" ]
}
] }
Note how it puts everything insider an array, I suppose because it doesn't know if the schema allows multiple instances of, say, <offset>
, inside <resultPage>
. So, to access my data, I'm always adding a [0]
at the end of everything.
Do I have to just live with this, or is there an elegant way around it?