Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion parse an xml snippet to a hash
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
doug livesey  
View profile   Translate to Translated (View Original)
 More options 2 July, 11:23
From: doug livesey <biot...@gmail.com>
Date: Thu, 2 Jul 2009 11:23:21 +0100
Local: Thurs 2 July 2009 11:23
Subject: parse an xml snippet to a hash

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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google