Go to Google Groups Home    NWRUG
parse an xml snippet to a hash

doug livesey <biot...@gmail.com>

Hi -- I have a custom ActiveResource action that returns the following xml:

"<result>\n  <successes>\n    <1>a082000000HqJzUAAV</1>\n
<2>a082000000HqJzsAAF</2>\n    <3>a082000000HqJzVAAV</3>\n  </successes>\n
<failures>\n  </failures>\n</result>\n"

Is there a quick & easy way to turn this into the following hash?

{ "result" { "successes" => { "1" => "a082000000HqJzUAAV", "2" =>
"a082000000HqJzsAAF", "3" => "a082000000HqJzVAAV" }, "failures" => {} }

Or should I go off & learn hpricot like I've been meaning to for ~3 years?
Cheers,
   Doug.