1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Reformatting an rss feed (weather) for a flash widget

Discussion in 'XML & RSS' started by DarkStormeDragon, Mar 14, 2013.

  1. #1
    Firstly hey all new here looks fantastic what ive read so far. Unfortunately though, unless its hidden within search criteria that i havent thought of yet, i cannot find anything for what im going to ask.

    What im after is a way to reformat an rss feed, not the content of the feed itself but the code. to best explaine what i wish to achieve ill present an example:

    Below is the rss feed for Melbourne (AUS) weather:

    <rss version="2.0">
      <channel>
        <title>Melbourne Weather</title>
        <link>####://###.weatherzone.com.au/warnings.jsp</link>
        <description>Weatherzone - forecasts, satellite, BoM radar and more</description>
        <pubDate>Wed, 13 Mar 2013 09:43:50 +1100</pubDate>
        <lastBuildDate>Wed, 13 Mar 2013 09:43:50 +1100</lastBuildDate>
        <language>en-au</language>
        <copyright>Copyright  The Weather Company</copyright>
        <docs>####://backend.userland.com/rss</docs>
        <image>
          <url>####://###.weatherzone.com.au/images/logos/weatherzone_logo_88x20.gif</url>
          <title>Weatherzone</title>
          <link>####://###.weatherzone.com.au</link>
          <width>88</width>
          <height>20</height>
        </image>
        <item>
          <title>Current weather for Melbourne at 9:30am EDT</title>
          <description><![CDATA[
     
            <b>Temperature:</b> 23.3°C
     
            <img align="top" src="####://###.weatherzone.com.au/images/widgets/nav_trend_down.gif" alt="falling"/>
     
            <br />
     
            <b>Feels like:</b> 23.3°C<br />
     
            <b>Dew point:</b> 16.4°C
     
            <img align="top" src="####://###.weatherzone.com.au/images/widgets/nav_trend_down.gif" alt="falling"/>
     
            <br />
     
            <b>Relative humidity:</b> 65%<br />
     
            <b>Wind:</b> WSW at 46 km/h, gusting to 59 km/h
     
            <img align="top" src="####://###.weatherzone.com.au/images/widgets/nav_trend_up.gif" alt="rising"/>
     
            <br />
     
            <b>Rain:</b> 0.0mm since 9am<br />
     
            <b>Pressure:</b> 1008.4 hPa
     
            <img align="top" src="####://###.weatherzone.com.au/images/widgets/nav_trend_up.gif" alt="rising"/>
     
            <br />
     
            ]]></description>
          <link>####://###.weatherzone.com.au/vic/melbourne/melbourne</link>
          <guid isPermaLink="true">####://###.weatherzone.com.au/vic/melbourne/melbourne</guid>
        </item>
        <item>
          <title>Melbourne weather forecast</title>
          <description><![CDATA[
     
    <b>Wednesday</b><br />
     
    <img src="####://###.weatherzone.com.au/images/icons/fcast_30/mostly_sunny.gif"><br />
     
    Mostly sunny<br />
     
    24°C - 29°C<br /><br />
     
    <b>Thursday</b><br />
     
    <img src="####://###.weatherzone.com.au/images/icons/fcast_30/clearing_shower.gif"><br />
     
    Clearing shower<br />
     
    15°C - 25°C<br /><br />
     
    <b>Friday</b><br />
     
    <img src="####://###.weatherzone.com.au/images/icons/fcast_30/mostly_sunny.gif"><br />
     
    Mostly sunny<br />
     
    14°C - 27°C<br /><br />
     
    <b>Saturday</b><br />
     
    <img src="####://###.weatherzone.com.au/images/icons/fcast_30/showers.gif"><br />
     
    Showers<br />
     
    16°C - 22°C<br /><br />
     
            ]]></description>
          <link>####://###.weatherzone.com.au/vic/melbourne/melbourne</link>
          <guid isPermaLink="true">####://###.weatherzone.com.au/vic/melbourne/melbourne</guid>
        </item>
        <item>
          <title>Melbourne weather</title>
          <description><![CDATA[
     
    <p><a href="####://###.weatherzone.com.au/radar.jsp?lt=radar&amp;lc=002">Melbourne weather radar</a></p>
     
    <p><a href="####://###.weatherzone.com.au/satellite.jsp?lt=wzstate&amp;lc=VIC">Satellite cloud map</a></p>
     
            ]]></description>
          <link>####://###.weatherzone.com.au/vic/melbourne</link>
          <guid>####://###.weatherzone.com.au/vic/melbourne/melbourne</guid>
        </item>
      </channel>
    </rss>
    Code (markup):
    Below is the rss feed for Tucson, AZ in the US:

    
    <?xml version="1.0" encoding="ISO-8859-1"?> 
    <?xml-stylesheet href="latest_ob.xsl" type="text/xsl"?>
    <current_observation version="1.0"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://www.weather.gov/view/current_observation.xsd">
        <credit>NOAA's National Weather Service</credit>
        <credit_URL>http://weather.gov/</credit_URL>
        <image>
            <url>http://weather.gov/images/xml_logo.gif</url>
            <title>NOAA's National Weather Service</title>
            <link>http://weather.gov</link>
        </image>
        <suggested_pickup>15 minutes after the hour</suggested_pickup>
        <suggested_pickup_period>60</suggested_pickup_period>
        <location>Tucson Intl Airport, AZ</location>
        <station_id>KTUS</station_id>
        <latitude>32.12</latitude>
        <longitude>-110.93</longitude>
        <observation_time>Last Updated on Mar 14 2013, 4:53 pm MST</observation_time>
            <observation_time_rfc822>Thu, 14 Mar 2013 16:53:00 -0700</observation_time_rfc822>
        <weather>Fair</weather>
        <temperature_string>92.0 F (33.3 C)</temperature_string>
        <temp_f>92.0</temp_f>
        <temp_c>33.3</temp_c>
        <relative_humidity>4</relative_humidity>
        <wind_string>Northeast at 4.6 MPH (4 KT)</wind_string>
        <wind_dir>Northeast</wind_dir>
        <wind_degrees>30</wind_degrees>
        <wind_mph>4.6</wind_mph>
        <wind_kt>4</wind_kt>
        <pressure_string>1013.3 mb</pressure_string>
        <pressure_mb>1013.3</pressure_mb>
        <pressure_in>30.04</pressure_in>
        <dewpoint_string>6.1 F (-14.4 C)</dewpoint_string>
        <dewpoint_f>6.1</dewpoint_f>
        <dewpoint_c>-14.4</dewpoint_c>
        <heat_index_string>88 F (31 C)</heat_index_string>
              <heat_index_f>88</heat_index_f>
              <heat_index_c>31</heat_index_c>
        <visibility_mi>10.00</visibility_mi>
         <icon_url_base>http://forecast.weather.gov/images/wtf/small/</icon_url_base>
        <two_day_history_url>http://www.weather.gov/data/obhistory/KTUS.html</two_day_history_url>
        <icon_url_name>skc.png</icon_url_name>
        <ob_url>http://www.weather.gov/data/METAR/KTUS.1.txt</ob_url>
        <disclaimer_url>http://weather.gov/disclaimer.html</disclaimer_url>
        <copyright_url>http://weather.gov/disclaimer.html</copyright_url>
        <privacy_policy_url>http://weather.gov/notice.html</privacy_policy_url>
    </current_observation>
    
    Code (markup):
    What i hope to achieve is to get the Melbourne weather RSS feed code to present itself like the US weather feed code.

    The reason for this is im making a weather flash widget and the ActionScript code that i have, ill note here that im a novice at actionscript,
    cant display anything from the Melbourne feed due to the fact there is no definitive/unique tags for me to call from.

    So is there a way for me to get the data from the Melbourne weather feed RSS, then reformat the code from the rss feed to a new XML document
    so that it clearly labels the tags like in the Tucson rss feed?

    Thanks in advance,

    DSD
     
    DarkStormeDragon, Mar 14, 2013 IP