Forum: Ruby NWS-NOAA: accessing attributes with SOAP4R

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Tom Verbeure (Guest)
on 2006-02-17 10:13
(Received via mailing list)
Hi Ruby Guru's,

I've successfully retrieved data from the NWS weather server with the
example that was give at the following link:

So far so good.

However, I'm only able to get text data, that is the data that's not
part of an XML tag. I did not find a way to access XML attributes.

E.g.: I have no problem to get the 'point1' information, indicated by
<location-key>, but I can find a way to get '

         <point latitude="38.99" longitude="-77.99" />
      <time-layout time-coordinate="local" summarization="none">

The closest I've gotten to see that the data is actually there is by

p data['location']['point'].__xmlattr

This prints something that lists 'latitude' and 'longitude'. But how do
I access the value itself?

p data['location']['point'].__xmlattr['latitude'] or
p data['location']['point'].latitude

doesn't work.

Any suggestions are greatly appreciated!

Holgi (Guest)
on 2006-02-17 10:40
(Received via mailing list)

Well, I'm not an expert (yet:) in Ruby, but I stumbled across the
"extraattr"-attribute of the SOAPElement in the SOAP4R-library.

See and for more

Maybe that'll help you?

Tom Verbeure (Guest)
on 2006-02-18 01:04
(Received via mailing list)
Hi Holgi,

Thanks for the pointers. Unfortunately, it seems that I'm dealing with
a SOAP::Mapping:Object instead of a SOAPElement. I'll let you know if I
make any progress.

This topic is locked and can not be replied to.