Message from discussion
parse an xml snippet to a hash
Received: by 10.223.106.129 with SMTP id x1mr148773fao.6.1246530222194;
Thu, 02 Jul 2009 03:23:42 -0700 (PDT)
Return-Path: <biot...@gmail.com>
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.157])
by gmr-mx.google.com with ESMTP id 16si240798bwz.4.2009.07.02.03.23.41;
Thu, 02 Jul 2009 03:23:41 -0700 (PDT)
Received-SPF: pass (google.com: domain of biot...@gmail.com designates 72.14.220.157 as permitted sender) client-ip=72.14.220.157;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of biot...@gmail.com designates 72.14.220.157 as permitted sender) smtp.mail=biot...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by fg-out-1718.google.com with SMTP id e21so459960fga.21
for <nwrug-members@googlegroups.com>; Thu, 02 Jul 2009 03:23:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:mime-version:received:from:date:message-id
:subject:to:content-type;
bh=lPTcmntI37igUAkzkM/MwqGlJD5Mvz5cC08rBT9wdKk=;
b=J8CZu+wVd+ytukqMGIevOOehi9tTOjyKWQPzVIF1nM+PO8+b5AZUHT/fAYFsjm55zV
i22vK/iJCV5Xltov+gO3v+CCbMcbN0NXi5j7yWRcy3l1NtJmFTSzxAb5eZ8zyFz9HSDW
B8AS2NuWjdrrsC9UbJeErIfdC1a0G2+q0ClyU=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=mime-version:from:date:message-id:subject:to:content-type;
b=An1SZCobS7peXEbLmQSr1KO7lRTtcHyAcSd7Jh31mA9FjHdGCu55xWGykavzDzK0lC
zRVdF9ZUL6Gt5ZNYZ2pNo2FfweZATXsaX9phTeWc7QL+pOHwXugNvKI6VsYM/EWh4Jwy
G+EQ4TBhhb2rimHLtCE/6JPKnCtGtl533jpWk=
MIME-Version: 1.0
Received: by 10.86.62.8 with SMTP id k8mr264194fga.52.1246530221076; Thu, 02
Jul 2009 03:23:41 -0700 (PDT)
From: doug livesey <biot...@gmail.com>
Date: Thu, 2 Jul 2009 11:23:21 +0100
Message-ID: <50873a360907020323x445baa8l767217625e205125@mail.gmail.com>
Subject: parse an xml snippet to a hash
To: nwrug-members@googlegroups.com
Content-Type: multipart/alternative; boundary=000e0cd2465207735e046db66fab
--000e0cd2465207735e046db66fab
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
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.
--000e0cd2465207735e046db66fab
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi -- I have a custom ActiveResource action that returns the following xml:=
<br><br>"<result>\n=A0 <successes>\n=A0=A0=A0 <1>a08=
2000000HqJzUAAV</1>\n=A0=A0=A0 <2>a082000000HqJzsAAF</2>\=
n=A0=A0=A0 <3>a082000000HqJzVAAV</3>\n=A0 </successes>\n=
=A0 <failures>\n=A0 </failures>\n</result>\n"<br>
<br>Is there a quick & easy way to turn this into the following hash?<b=
r><br>{ "result" { "successes" =3D> { "1" =
=3D> "a082000000HqJzUAAV", "2" =3D> "a082000=
000HqJzsAAF", "3" =3D> "a082000000HqJzVAAV" }, =
"failures" =3D> {} }<br>
<br>Or should I go off & learn hpricot like I've been meaning to fo=
r ~3 years?<br>Cheers,<br>=A0=A0 Doug.<br>
--000e0cd2465207735e046db66fab--