read and display xml data file
Posted: 01st November 2009 06:39 PM

Hi everyone

I’m trying to read and display weather data from my weather-station at wunderground.com. The data is embedded in an xml file which is displayed below.

Any idea?

Thanks in advance

BS, Iceland

xml file:
<current_observation>
<credit>Weather Underground Personal Weather Station</credit>
<credit_URL>http://wunderground.com/weatherstation/</credit_URL>

<image>

<url>
bh-wui_logo.gif
</url>
<title>Weather Underground</title>
<link>http://wunderground.com/weatherstation/</link>
</image>

<location>
<full>, Hvammur, Skorradalur</full>
<neighborhood>
<city>Hvammur</city>
<state>Skorradalur</state>
<zip>
<latitude>64.532867</latitude>
<longitude>-21.526926</longitude>
<elevation>400 ft</elevation>
</location>
<station_id>IBORGARF2</station_id>
<station_type>Davis Vantage pro</station_type>
<observation_time>Last Updated on November 1, 5:32 PM GMT</observation_time>
<observation_time_rfc822>Sun, 01 November 2009 17:32:38 GMT</observation_time_rfc822>
<weather>
<temperature_string>29.9 F (-1.2 C)</temperature_string>
<temp_f>29.9</temp_f>
<temp_c>-1.2</temp_c>
<relative_humidity>94</relative_humidity>
<wind_string>Calm</wind_string>
<wind_dir>WNW</wind_dir>
<wind_degrees>303</wind_degrees>
<wind_mph>0.0</wind_mph>
<wind_gust_mph>-999.0</wind_gust_mph>
29.42” (996.2 mb)</pressure_string>
996.2</pressure_mb>
29.42</pressure_in>
<dewpoint_string>28.0 F (-2.2 C)</dewpoint_string>
<dewpoint_f>28.0</dewpoint_f>
<dewpoint_c>-2.2</dewpoint_c>
<heat_index_string>
<heat_index_f>
<heat_index_c>
<windchill_string>
<windchill_f>
<windchill_c>
<solar_radiation>
<UV>
-999.00 in (-2537.5 mm)</precip_1hr_string>
-999.00</precip_1hr_in>
-2537.5</precip_1hr_metric>
0.00 in (0.0 mm)</precip_today_string>
0.00</precip_today_in>
0.0</precip_today_metric>

<history_url>
http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=IBORGARF2
</history_url>

<ob_url>
http://www.wunderground.com/cgi-bin/findweather/getForecast?query=64.532867,-21.526926
</ob_url>
</current_observation>

#1.  Posted: 02nd November 2009 02:38 AM

I think that the link below may help you:

http://www.w3schools.com/Xml/xml_display.asp

Scott

 Signature 

RW 4.1.0, MacBook Pro 1.84GHz, 1GB RAM.

#2.  Posted: 18th July 2010 02:12 PM

The task of interpreting the XML and extracting data from it is called parsing. CSS/XSLT will format the XML, but if you want to parse it (e.g., only display some of the data) you’ll need to use a program on either the server side or the client side (browser) to do so. On the server side, you could do this with a PHP XML parsing library like this one:

http://keithdevens.com/software/phpxml

On the client side, you could do it in JavaScript with a jQuery plugin like this one:

http://jparse.kylerush.net/

Vasily

 Signature 

When the past no longer illuminates the future, the spirit walks in darkness.

     —Alexis de Tocqueville

RW Reviews | RapidAnswers wiki | The High-Tech Coach | Bluehost Affiliate Link

#3.  Posted: 18th July 2010 09:20 PM

Sorry, I should have posted this to the original thread. Thanks to everybody that has responded. This does not however seem to be super easy task for a guy with limited programming experience.