R
Richard in Va.
Hello,
Where might I find assistance with the Parsing of xml/rss weather feeds using Perl
Compatible Regular Expressions?
I've downloaded the desktop widget called Rainy's Rainmeter, found at...
http://www.ipi.fi/~rainy/index.php?pn=projects&project=rainmeter
One of the widgets provides the current weather conditions. (reconfigure for your
location).
I've edit it to make it a little bigger and to show more current information like wind
speed, wind gust, wind chill and so on.
My problem is that I can't parse the xml/rss feed beyond current conditions, The feed I
download includes the 5-day forecast so I know it's available. I just don't know how to
parse the 5-day forecast using perl regular expressions.
Here is the rss feed...
http://xoap.weather.com/weather/local/24522?cc=*&unit=m&dayf=5
Below is the code I'm using to parse the current weather conditions down to "Dew Point".
This is working well for me. I assume this is an uncompiled "long-hand" approach. But even
I can understand and edit it later if needed. I'm sure someone will ask what's with all
the extra (.+)'s. I read somewhere in the Rainy forums that this method might prevent some
parsing issues. So I tried it and it works, the web parser just skips a number when it
assigns values to the string indexes.
RegExp="(?siU)<weather
ver="(.+)">(.+)<dnam>(.+)</dnam>(.+)<tm>(.+)</tm>(.+)<sunr>(.+)</sunr>(.+)<suns>(.+)</suns>(.+)<lsup>(.+)</lsup>(.+)<obst>(.+)</obst>(.+)<tmp>(.+)</tmp>(.+)<flik>(.+)</flik>(.+)<t>(.+)</t>(.+)<icon>(.+)</icon>(.+)<r>(.+)</r>(.+)<d>(.+)</d>(.+)<s>(.+)</s>(.+)<gust>(.+)</gust>(.+)<d>(.+)</d>(.+)<t>(.+)</t>(.+)<hmid>(.+)</hmid>(.+)<vis>(.+)</vis>(.+)<dewp>(.+)</dewp>"
The RegExp above is treated all as one (1) line.
The Rainy Webparser will generate a log file I can view to see what value it's assigned to
the string indexes.
If I could get help with parsing " Today's Forecast ", which is Day #0 (day d="0") in the
rss feed. I could continue the code myself to parse day #1-4 for the 5-day forecast.
<dayf>
<lsup>8/24/06 1:08 PM EDT</lsup>
<day d="0" t="Thursday" dt="Aug 24">
<hi>33</hi>
<low>18</low>
and so-on.
The "<day d="0" t="Thursday" dt="Aug 24"> " is what I can't seem to get past.
I would like to parse ALL the available information for the given day. The Rainy web
parser will assign a string index # for each element parsed. Then I can pick-and-choose
the ones I want displayed on the widget.
By the way, the clock is a piece of art. love it! Also, the calendar, found from the Rainy
web site. Look to the left under Projects|Rainlendar. That is a must have in my opinion!
Nice stuff.!
Yes I know, alittle OT. But I've read through the Rainy manuals, read through his
discussion forums, google searched and have tried several of the on-line code testers with
little luck.
I'm not a programmer, I'm a tinker-er. So I know little to nothing about scripting.
Is there a newsgroup for Perl scripting help?
Best regards,
Richard in VA.
++++++++++++++++++++++++++++++++
Where might I find assistance with the Parsing of xml/rss weather feeds using Perl
Compatible Regular Expressions?
I've downloaded the desktop widget called Rainy's Rainmeter, found at...
http://www.ipi.fi/~rainy/index.php?pn=projects&project=rainmeter
One of the widgets provides the current weather conditions. (reconfigure for your
location).
I've edit it to make it a little bigger and to show more current information like wind
speed, wind gust, wind chill and so on.
My problem is that I can't parse the xml/rss feed beyond current conditions, The feed I
download includes the 5-day forecast so I know it's available. I just don't know how to
parse the 5-day forecast using perl regular expressions.
Here is the rss feed...
http://xoap.weather.com/weather/local/24522?cc=*&unit=m&dayf=5
Below is the code I'm using to parse the current weather conditions down to "Dew Point".
This is working well for me. I assume this is an uncompiled "long-hand" approach. But even
I can understand and edit it later if needed. I'm sure someone will ask what's with all
the extra (.+)'s. I read somewhere in the Rainy forums that this method might prevent some
parsing issues. So I tried it and it works, the web parser just skips a number when it
assigns values to the string indexes.
RegExp="(?siU)<weather
ver="(.+)">(.+)<dnam>(.+)</dnam>(.+)<tm>(.+)</tm>(.+)<sunr>(.+)</sunr>(.+)<suns>(.+)</suns>(.+)<lsup>(.+)</lsup>(.+)<obst>(.+)</obst>(.+)<tmp>(.+)</tmp>(.+)<flik>(.+)</flik>(.+)<t>(.+)</t>(.+)<icon>(.+)</icon>(.+)<r>(.+)</r>(.+)<d>(.+)</d>(.+)<s>(.+)</s>(.+)<gust>(.+)</gust>(.+)<d>(.+)</d>(.+)<t>(.+)</t>(.+)<hmid>(.+)</hmid>(.+)<vis>(.+)</vis>(.+)<dewp>(.+)</dewp>"
The RegExp above is treated all as one (1) line.
The Rainy Webparser will generate a log file I can view to see what value it's assigned to
the string indexes.
If I could get help with parsing " Today's Forecast ", which is Day #0 (day d="0") in the
rss feed. I could continue the code myself to parse day #1-4 for the 5-day forecast.
<dayf>
<lsup>8/24/06 1:08 PM EDT</lsup>
<day d="0" t="Thursday" dt="Aug 24">
<hi>33</hi>
<low>18</low>
and so-on.
The "<day d="0" t="Thursday" dt="Aug 24"> " is what I can't seem to get past.
I would like to parse ALL the available information for the given day. The Rainy web
parser will assign a string index # for each element parsed. Then I can pick-and-choose
the ones I want displayed on the widget.
By the way, the clock is a piece of art. love it! Also, the calendar, found from the Rainy
web site. Look to the left under Projects|Rainlendar. That is a must have in my opinion!
Nice stuff.!
Yes I know, alittle OT. But I've read through the Rainy manuals, read through his
discussion forums, google searched and have tried several of the on-line code testers with
little luck.
I'm not a programmer, I'm a tinker-er. So I know little to nothing about scripting.
Is there a newsgroup for Perl scripting help?
Best regards,
Richard in VA.
++++++++++++++++++++++++++++++++