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

View Parsed - Show only message text

Received: by 10.211.194.9 with SMTP id w9mr629967ebp.14.1246530561341;
        Thu, 02 Jul 2009 03:29:21 -0700 (PDT)
Return-Path: <w...@willj.net>
Received: from ey-out-1920.google.com (ey-out-1920.google.com [74.125.78.150])
        by gmr-mx.google.com with ESMTP id 16si537015ewy.3.2009.07.02.03.29.21;
        Thu, 02 Jul 2009 03:29:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of w...@willj.net designates 74.125.78.150 as permitted sender) client-ip=74.125.78.150;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of w...@willj.net designates 74.125.78.150 as permitted sender) smtp.mail=w...@willj.net
Received: by ey-out-1920.google.com with SMTP id 5so473463eyb.6
        for <nwrug-members@googlegroups.com>; Thu, 02 Jul 2009 03:29:21 -0700 (PDT)
Received: by 10.210.102.12 with SMTP id z12mr4862123ebb.89.1246530561134;
        Thu, 02 Jul 2009 03:29:21 -0700 (PDT)
Return-Path: <w...@willj.net>
Received: from pleb.config (93-97-31-134.zone5.bethere.co.uk [93.97.31.134])
        by mx.google.com with ESMTPS id 28sm1956611eyg.24.2009.07.02.03.29.20
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Thu, 02 Jul 2009 03:29:20 -0700 (PDT)
Message-Id: <882D4922-F59B-4972-B7D8-AE5B179A9D1B@willj.net>
From: Will Jessop <w...@willj.net>
To: nwrug-members@googlegroups.com
In-Reply-To: <50873a360907020323x445baa8l767217625e205125@mail.gmail.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v935.3)
Subject: Re: [NWRUG] parse an xml snippet to a hash
Date: Thu, 2 Jul 2009 11:29:15 +0100
References: <50873a360907020323x445baa8l767217625e205125@mail.gmail.com>
X-Mailer: Apple Mail (2.935.3)

On 2 Jul 2009, at 11:23, doug livesey wrote:
> 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" =>  
> {} }


This might help:

http://xml-mapping.rubyforge.org/

Not used it myself though.

Will.

-- 
Will Jessop
Super Shiny Robot Limited - Professional web design and development

t: 07939 547 962
w: http://supershinyrobot.com/


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