It is currently May 8th, 2024, 6:00 am

Weather skin, parsing elements

Get help with creating, editing & fixing problems with skins
System
Posts: 3
Joined: April 15th, 2011, 1:43 pm

Weather skin, parsing elements

Post by System »

Hi,

Im creating a weather skin based on the this RSS: http://xml.weather.com/weather/local/PLXX0049?cc=*&unit=m

My parse code is:

Code: Select all

Url=http://xml.weather.com/weather/local/#dest#?cc=*&unit=#SCALE#
RegExp="(?siU)<weather ver="(.*).0">.*<head>.*<locale>.*</locale>.*<form>.*</form>.*<ut>.*</ut>.*<ud>.*</ud>.*<us>.*</us>.*<up>.*</up>.*<ur>.*</ur>.*</head>.*<loc id="(.*)">.*<dnam>(.*)</dnam>.*<tm>.*</tm>.*<lat>(.*)</lat>.*<lon>(.*)</lon>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<zone>.*</zone>.*</loc>.*<cc>.*<lsup>.*</lsup>.*<obst>.*</obst>.*<tmp>(.*)</tmp>.*<flik>.*</flik>.*<t>.*</t>.*<icon>(.*)</icon>.*<bar>.*<r>.*</r>.*<d>.*</d>.*</bar>.*<wind>.*<s>(.*)</s>.*<gust>.*</gust>.*<d>.*</d>.*<t>.*</t>.*</wind>.*<hmid>(.*)</hmid>.*<vis>(.*)</vis>"
In the RSS I want to gather the name of the city, as we see here the location of my city is Lublin, Poland . If we look closer on the script of RSS we can see:

Code: Select all

<loc id="PLXX0049">
    <dnam>Lublin, Poland</dnam>
The problem is I just want to show in my weather skin the location of my city as LUBLIN only without the coma and POLAND.

What should I change in my parsing code to do that? I just want to display only LUBLIN in my weather skin.
Please help.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather skin, parsing elements

Post by jsmorley »

You could change:

<dnam>(.*)</dnam>.*

To

<dnam>(.*),.*</dnam>.*