NWS-NOAA: accessing attributes with SOAP4R

T

Tom Verbeure

Hi Ruby Guru's,

I've successfully retrieved data from the NWS weather server with the
example that was give at the following link:
http://groups.google.com/group/comp.lang.ruby/msg/5fb9a1506ea46b2e

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 '

<location>
<location-key>point1</location-key>
<point latitude="38.99" longitude="-77.99" />
</location>
<time-layout time-coordinate="local" summarization="none">
<layout-key>k-p24h-n7-1</layout-key>

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

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!

Tom
 
T

Tom Verbeure

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.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top