Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » VB.NET » General » Downloads
 
Add your own
alternative version

Weather Forecast with Yahoo! Weather RSS Feed

, 13 Jul 2009 CPOL
A class based on the Yahoo! Weather RSS feed.
yahooweather-win-asp.zip
YahooWeather
YahooWeather2005
YahooWeatherLib
bin
Debug
YahooWeatherLib.dll
YahooWeatherLib.pdb
My Project
Application.myapp
Settings.settings
YahooWeatherWeb
App_Data
Bin
YahooWeatherLib.dll
YahooWeatherLib.pdb
YahooWeatherWin
bin
Debug
My Project
Application.myapp
Settings.settings
YahooWeather2008
YahooWeatherLib
bin
Debug
YahooWeatherLib.dll
YahooWeatherLib.pdb
My Project
Application.myapp
Settings.settings
YahooWeatherWeb
App_Code
App_Data
Bin
YahooWeatherLib.dll
YahooWeatherLib.pdb
YahooWeatherWin
bin
Debug
My Project
Application.myapp
Settings.settings
yahooweather.zip
Library
YahooWeatherLib
bin
Debug
YahooWeatherLib.dll
My Project
Application.myapp
Settings.settings
obj
Debug
TempPE
UI
Web
YahooWeatherWeb
App_Code
App_Data
Bin
YahooWeatherLib.dll
Win
YahooWeatherWinCSharp
bin
Debug
YahooWeatherLib.dll
YahooWeatherWinCSharp.exe
obj
Debug
TempPE
Properties
Settings.settings
YahooWeatherWinCSharp.csproj.user
YahooWeatherWinVB
bin
Debug
YahooWeatherLib.dll
YahooWeatherWin.exe
YahooWeatherWin.vshost.exe
My Project
Application.myapp
Settings.settings
obj
Debug
TempPE
yahooweather2.zip
App_Code
App_Data
yahooweatherwin-asp.zip
YahooWeatherLib
bin
Debug
YahooWeatherLib.dll
YahooWeatherLib.pdb
My Project
Application.myapp
Settings.settings
obj
Debug
TempPE
YahooWeatherLib.dll
YahooWeatherLib.pdb
YahooWeatherLib.Resources.resources
YahooWeatherLib.vbproj.GenerateResource.Cache
YahooWeatherWeb
App_Data
Bin
YahooWeatherLib.dll
YahooWeatherLib.pdb
YahooWeatherWin
bin
Debug
YahooWeatherLib.dll
YahooWeatherLib.pdb
YahooWeatherWin.exe
YahooWeatherWin.pdb
YahooWeatherWin.vshost.exe
My Project
Application.myapp
Settings.settings
obj
Debug
ResolveAssemblyReference.cache
TempPE
YahooWeatherWin.exe
YahooWeatherWin.Form1.resources
YahooWeatherWin.pdb
YahooWeatherWin.Resources.resources
YahooWeatherWin.vbproj.GenerateResource.Cache
Imports Microsoft.VisualBasic
Imports System.Xml.Serialization
Public Class YahooWeatherForecast
    Public Enum conditionCode
        tornado = 0
        tropical_storm = 1
        hurricane = 2
        severe_thunderstorms = 3
        thunderstorms = 4
        mixed_rain_and_snow = 5
        mixed_rain_and_sleet = 6
        mixed_snow_and_sleet = 7
        freezing_drizzle = 8
        drizzle = 9
        freezing_rain = 10
        showers = 11
        showers_ = 12
        snow_flurries = 13
        light_snow_showers = 14
        blowing_snow = 15
        snow = 16
        hail = 17
        sleet = 18
        dust = 19
        foggy = 20
        haze = 21
        smoky = 22
        blustery = 23
        windy = 24
        cold = 25
        cloudy = 26
        mostly_cloudy_night = 27
        mostly_cloudy_day = 28
        partly_cloudy_night = 29
        partly_cloudy_day = 30
        clear_night = 31
        sunny = 32
        fair_night = 33
        fair_day = 34
        mixed_rain_and_hail = 35
        hot = 36
        isolated_thunderstorms = 37
        scattered_thunderstorms = 38
        scattered_thunderstorms_ = 39
        scattered_showers = 40
        heavy_snow = 41
        scattered_snow_showers = 42
        heavy_snow_ = 43
        partly_cloudy = 44
        thundershowers = 45
        snow_showers = 46
        isolated_thundershowers = 47
        not_available = 3200
    End Enum

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="p">US zip code or Location ID. </param>
    ''' <param name="U">Units for temperature.  f: Fahrenheit   c: Celsius</param>
    ''' <remarks></remarks>
    Sub New(ByVal p As String, ByVal U As String)
        Dim doc As New System.Xml.XmlDocument()
        Dim str As String = "http://weather.yahooapis.com/forecastrss?p=" & p & "&u=" & U
        Dim c As rssClass
        'Load data   
        doc.Load(str)
        str = doc.OuterXml


        'XmlSerializer could not Serialize XML with this Elements so i just replace them with Null String!
        str = str.Replace("yweather:", "")
        str = str.Replace("geo:", "")

        Dim memoryStream As New IO.MemoryStream()
        Dim d As New IO.StringReader(str)


        Dim xs As New XmlSerializer(GetType(rssClass))

        c = CType(xs.Deserialize(d), rssClass)

        rss = c

    End Sub

    Private _rss As rssClass
    <XmlElement()> _
    Public Property rss() As rssClass
        Get
            Return _rss
        End Get
        Set(ByVal value As rssClass)
            _rss = value
        End Set
    End Property
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Farhad Siasar Djahantighi 2

Iran (Islamic Republic Of) Iran (Islamic Republic Of)
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 13 Jul 2009
Article Copyright 2007 by Farhad Siasar Djahantighi 2
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid