I just got it to work using:
puts (node/"subscriber:Detail").xpath("@instance:type").to_s
I forgot to mention that in this case, node was a XMLNodeSelection
instance pointing to <PaymentInstrument>. Hopefully this helps
someone else.
On Sep 21, 10:01 am, Aaron Carlton
<aaron.r.carl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> I am using Handsoap to integrate my Rails app with a SOAP web service,
> and when parsing the XML in the response, I need to change behavior
> depending on an element''s ''type'' attribute. A
snippet of the XML
> response is below:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
> <s:Body>
> <RetrieveEWalletForSubscriberResponse xmlns="http://
> ContentDirect.SubscriberManagement">
> <FaultDetails
xmlns:a="http://schemas.datacontract.org/2004/07/
> ContentDirect.Framework.Contract.Message"
xmlns:i="http://www.w3.org/
> 2001/XMLSchema-instance" i:nil="true"/>
> <PaymentInstruments
xmlns:i="http://www.w3.org/2001/XMLSchema-
> instance">
> <PaymentInstrument>
> <CreatedDate>2010-09-15T17:25:24.567</CreatedDate>
> <Detail i:type="PaymentInstrumentCreditCard">
> <AccountNumber>************9736</AccountNumber>
> <BillingAddress>
> <AddDate>2010-08-20T05:52:39.55</AddDate>
>
> I''ve tried to get the Detail node''s
''type'' attribute using XPATH the
> following ways:
>
> puts (node/"subscriber:Detail"["@type"]).to_s
> puts (node/"subscriber:Detail@instance:type").to_s
>
> and using a number of namespace combinations, but no luck. Does
> anyone have experience or ideas on parsing XML attribute values using
> Handsoap?
>
> Thanks in advance!
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.