When i try to get info from some nodes in the document visual studio gives the message 'ERROR. Root/head element not found'. When i try to use the webrequest method it again gives that error, how can i make this work?
the URL = http://asus1.accu-weather.com/widget...ric=1&langId=1
Whole XML-Document:
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="utf-8"?>
- <adc_database xmlns="http://www.accuweather.com">
- <units>
- <temp>C</temp>
- <dist>KM</dist>
- <speed>KPH</speed>
- <pres>kPa</pres>
- <prec>MM</prec>
- </units>
- <local>
- <city>Dinteloord</city>
- <adminArea code="NB">North Brabant</adminArea>
- <country code="NL">Netherlands</country>
- <cityId>249273</cityId>
- <primaryCityId>249273</primaryCityId>
- <locationKey>249273</locationKey>
- <lat>51.63652</lat>
- <lon>4.37136</lon>
- <time>17:33</time>
- <timeZone>1</timeZone>
- <obsDaylight>
- 1
- </obsDaylight>
- <currentGmtOffset>2</currentGmtOffset>
- <timeZoneAbbreviation>CEST</timeZoneAbbreviation>
- </local>
- <currentconditions daylight="True">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/current.aspx?p=asus1&cityId=249273</url>
- <observationtime>5:33 PM</observationtime>
- <pressure state="Decreasing">101</pressure>
- <temperature>6</temperature>
- <realfeel>0</realfeel>
- <humidity>56%</humidity>
- <weathertext>Partly Sunny</weathertext>
- <weathericon>03</weathericon>
- <windgusts>27</windgusts>
- <windspeed>27</windspeed>
- <winddirection>NE</winddirection>
- <visibility>16</visibility>
- <precip>0.0</precip>
- <uvindex index="0">Low</uvindex>
- <dewpoint>-2</dewpoint>
- <cloudcover>35%</cloudcover>
- <apparenttemp>7</apparenttemp>
- <windchill>2</windchill>
- </currentconditions>
- <forecast>
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/forecast.aspx?p=asus1&cityId=249273</url>
- <day number="1">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/details1.aspx?p=asus1&cityId=249273</url>
- <obsdate>4/4/2013</obsdate>
- <daycode>Thursday</daycode>
- <sunrise>7:12 AM</sunrise>
- <sunset>8:20 PM</sunset>
- <daytime>
- <txtshort>Mostly cloudy</txtshort>
- <txtlong>Mostly cloudy</txtlong>
- <weathericon>06</weathericon>
- <hightemperature>6</hightemperature>
- <lowtemperature>-1</lowtemperature>
- <realfeelhigh>2</realfeelhigh>
- <realfeellow>-6</realfeellow>
- <windspeed>23</windspeed>
- <winddirection>ENE</winddirection>
- <windgust>53</windgust>
- <maxuv>4</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </daytime>
- <nighttime>
- <txtshort>Partly cloudy</txtshort>
- <txtlong>Partly cloudy</txtlong>
- <weathericon>35</weathericon>
- <hightemperature>6</hightemperature>
- <lowtemperature>-1</lowtemperature>
- <realfeelhigh>0</realfeelhigh>
- <realfeellow>-6</realfeellow>
- <windspeed>13</windspeed>
- <winddirection>NE</winddirection>
- <windgust>24</windgust>
- <maxuv>4</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </nighttime>
- </day>
- <day number="2">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/details2.aspx?p=asus1&cityId=249273</url>
- <obsdate>4/5/2013</obsdate>
- <daycode>Friday</daycode>
- <sunrise>7:10 AM</sunrise>
- <sunset>8:22 PM</sunset>
- <daytime>
- <txtshort>Low clouds</txtshort>
- <txtlong>Low clouds</txtlong>
- <weathericon>08</weathericon>
- <hightemperature>7</hightemperature>
- <lowtemperature>1</lowtemperature>
- <realfeelhigh>3</realfeelhigh>
- <realfeellow>-6</realfeellow>
- <windspeed>16</windspeed>
- <winddirection>NE</winddirection>
- <windgust>24</windgust>
- <maxuv>1</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </daytime>
- <nighttime>
- <txtshort>Partly cloudy</txtshort>
- <txtlong>Partly cloudy</txtlong>
- <weathericon>35</weathericon>
- <hightemperature>7</hightemperature>
- <lowtemperature>1</lowtemperature>
- <realfeelhigh>2</realfeelhigh>
- <realfeellow>-3</realfeellow>
- <windspeed>11</windspeed>
- <winddirection>NE</winddirection>
- <windgust>16</windgust>
- <maxuv>1</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </nighttime>
- </day>
- <day number="3">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/details3.aspx?p=asus1&cityId=249273</url>
- <obsdate>4/6/2013</obsdate>
- <daycode>Saturday</daycode>
- <sunrise>7:08 AM</sunrise>
- <sunset>8:24 PM</sunset>
- <daytime>
- <txtshort>Mostly cloudy</txtshort>
- <txtlong>Mostly cloudy</txtlong>
- <weathericon>06</weathericon>
- <hightemperature>9</hightemperature>
- <lowtemperature>-2</lowtemperature>
- <realfeelhigh>6</realfeelhigh>
- <realfeellow>-3</realfeellow>
- <windspeed>14</windspeed>
- <winddirection>NNE</winddirection>
- <windgust>21</windgust>
- <maxuv>4</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </daytime>
- <nighttime>
- <txtshort>Partly cloudy</txtshort>
- <txtlong>Partly cloudy</txtlong>
- <weathericon>35</weathericon>
- <hightemperature>9</hightemperature>
- <lowtemperature>-2</lowtemperature>
- <realfeelhigh>3</realfeelhigh>
- <realfeellow>-3</realfeellow>
- <windspeed>8</windspeed>
- <winddirection>NE</winddirection>
- <windgust>16</windgust>
- <maxuv>4</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </nighttime>
- </day>
- <day number="4">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/details4.aspx?p=asus1&cityId=249273</url>
- <obsdate>4/7/2013</obsdate>
- <daycode>Sunday</daycode>
- <sunrise>7:06 AM</sunrise>
- <sunset>8:25 PM</sunset>
- <daytime>
- <txtshort>Partly sunny</txtshort>
- <txtlong>Partly sunny</txtlong>
- <weathericon>03</weathericon>
- <hightemperature>9</hightemperature>
- <lowtemperature>-1</lowtemperature>
- <realfeelhigh>12</realfeelhigh>
- <realfeellow>0</realfeellow>
- <windspeed>6</windspeed>
- <winddirection>E</winddirection>
- <windgust>13</windgust>
- <maxuv>4</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </daytime>
- <nighttime>
- <txtshort>Cloudy</txtshort>
- <txtlong>Cloudy</txtlong>
- <weathericon>07</weathericon>
- <hightemperature>9</hightemperature>
- <lowtemperature>-1</lowtemperature>
- <realfeelhigh>3</realfeelhigh>
- <realfeellow>-1</realfeellow>
- <windspeed>6</windspeed>
- <winddirection>ESE</winddirection>
- <windgust>13</windgust>
- <maxuv>4</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </nighttime>
- </day>
- <day number="5">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/details5.aspx?p=asus1&cityId=249273</url>
- <obsdate>4/8/2013</obsdate>
- <daycode>Monday</daycode>
- <sunrise>7:03 AM</sunrise>
- <sunset>8:27 PM</sunset>
- <daytime>
- <txtshort>Times of clouds and sun</txtshort>
- <txtlong>Times of clouds and sun</txtlong>
- <weathericon>04</weathericon>
- <hightemperature>11</hightemperature>
- <lowtemperature>1</lowtemperature>
- <realfeelhigh>13</realfeelhigh>
- <realfeellow>1</realfeellow>
- <windspeed>5</windspeed>
- <winddirection>SE</winddirection>
- <windgust>10</windgust>
- <maxuv>3</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </daytime>
- <nighttime>
- <txtshort>Mainly clear</txtshort>
- <txtlong>Mainly clear</txtlong>
- <weathericon>34</weathericon>
- <hightemperature>11</hightemperature>
- <lowtemperature>1</lowtemperature>
- <realfeelhigh>6</realfeelhigh>
- <realfeellow>0</realfeellow>
- <windspeed>5</windspeed>
- <winddirection>SE</winddirection>
- <windgust>10</windgust>
- <maxuv>3</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </nighttime>
- </day>
- <day number="6">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/details6.aspx?p=asus1&cityId=249273</url>
- <obsdate>4/9/2013</obsdate>
- <daycode>Tuesday</daycode>
- <sunrise>7:01 AM</sunrise>
- <sunset>8:29 PM</sunset>
- <daytime>
- <txtshort>Cloudy</txtshort>
- <txtlong>Cloudy</txtlong>
- <weathericon>07</weathericon>
- <hightemperature>14</hightemperature>
- <lowtemperature>7</lowtemperature>
- <realfeelhigh>11</realfeelhigh>
- <realfeellow>3</realfeellow>
- <windspeed>14</windspeed>
- <winddirection>SE</winddirection>
- <windgust>26</windgust>
- <maxuv>2</maxuv>
- <rainamount>0.0</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.0</precipamount>
- <tstormprob>0</tstormprob>
- </daytime>
- <nighttime>
- <txtshort>Periods of rain</txtshort>
- <txtlong>Periods of rain</txtlong>
- <weathericon>18</weathericon>
- <hightemperature>14</hightemperature>
- <lowtemperature>7</lowtemperature>
- <realfeelhigh>7</realfeelhigh>
- <realfeellow>2</realfeellow>
- <windspeed>14</windspeed>
- <winddirection>SSE</winddirection>
- <windgust>23</windgust>
- <maxuv>2</maxuv>
- <rainamount>5.5</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>5.5</precipamount>
- <tstormprob>0</tstormprob>
- </nighttime>
- </day>
- <day number="7">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/details7.aspx?p=asus1&cityId=249273</url>
- <obsdate>4/10/2013</obsdate>
- <daycode>Wednesday</daycode>
- <sunrise>6:59 AM</sunrise>
- <sunset>8:30 PM</sunset>
- <daytime>
- <txtshort>A couple of showers</txtshort>
- <txtlong>A couple of showers</txtlong>
- <weathericon>12</weathericon>
- <hightemperature>13</hightemperature>
- <lowtemperature>9</lowtemperature>
- <realfeelhigh>11</realfeelhigh>
- <realfeellow>3</realfeellow>
- <windspeed>13</windspeed>
- <winddirection>SSW</winddirection>
- <windgust>21</windgust>
- <maxuv>4</maxuv>
- <rainamount>2.1</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>2.1</precipamount>
- <tstormprob>20</tstormprob>
- </daytime>
- <nighttime>
- <txtshort>A couple of showers</txtshort>
- <txtlong>A couple of showers</txtlong>
- <weathericon>12</weathericon>
- <hightemperature>13</hightemperature>
- <lowtemperature>9</lowtemperature>
- <realfeelhigh>10</realfeelhigh>
- <realfeellow>5</realfeellow>
- <windspeed>11</windspeed>
- <winddirection>SSW</winddirection>
- <windgust>26</windgust>
- <maxuv>4</maxuv>
- <rainamount>2.7</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>2.7</precipamount>
- <tstormprob>20</tstormprob>
- </nighttime>
- </day>
- <day number="8">
- <url>http://www.accuweather.com/m/en-us/NL/NB/Dinteloord/details8.aspx?p=asus1&cityId=249273</url>
- <obsdate>4/11/2013</obsdate>
- <daycode>Thursday</daycode>
- <sunrise>6:57 AM</sunrise>
- <sunset>8:32 PM</sunset>
- <daytime>
- <txtshort>A chance of rain</txtshort>
- <txtlong>A chance of rain</txtlong>
- <weathericon>06</weathericon>
- <hightemperature>13</hightemperature>
- <lowtemperature>6</lowtemperature>
- <realfeelhigh>10</realfeelhigh>
- <realfeellow>6</realfeellow>
- <windspeed>16</windspeed>
- <winddirection>SW</winddirection>
- <windgust>42</windgust>
- <maxuv>4</maxuv>
- <rainamount>2.3</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>2.3</precipamount>
- <tstormprob>12</tstormprob>
- </daytime>
- <nighttime>
- <txtshort>Mostly cloudy</txtshort>
- <txtlong>Mostly cloudy</txtlong>
- <weathericon>38</weathericon>
- <hightemperature>13</hightemperature>
- <lowtemperature>6</lowtemperature>
- <realfeelhigh>7</realfeelhigh>
- <realfeellow>-1</realfeellow>
- <windspeed>19</windspeed>
- <winddirection>SW</winddirection>
- <windgust>40</windgust>
- <maxuv>4</maxuv>
- <rainamount>0.4</rainamount>
- <snowamount>0.00</snowamount>
- <iceamount>0.0</iceamount>
- <precipamount>0.4</precipamount>
- <tstormprob>20</tstormprob>
- </nighttime>
- </day>
- </forecast>
- <copyright>Copyright 2013 AccuWeather.com</copyright>
- <use>This document is intended only for use by authorized licensees of AccuWeather.com. Unauthorized use is prohibited. All Rights Reserved.</use>
- <product>asus1</product>
- <redistribution>Redistribution Prohibited.</redistribution>
- </adc_database>
Expand|Select|Wrap|Line Numbers
- Imports System.Net
- Imports System.IO
- Imports System.Xml
- Public Class WeatherClient
- #Region "Constructor"
- Public Sub New(ByVal cityname As String)
- locat = cityname
- getconditions()
- End Sub
- #End Region
- #Region "Inner classes"
- Public Class CurrentConditions
- Dim cond As String
- Dim tmp As String
- Dim wnd As String
- Dim wnddir As String
- Dim rlfl As String
- Dim humid As Integer
- Dim visib As Integer
- Dim precip As Integer
- Dim uvindx As String
- Dim dwpnt As Integer
- Dim clcover As Integer
- Dim wchill As Integer
- Public ReadOnly Property Condition As String
- Get
- Return cond
- End Get
- End Property
- Public ReadOnly Property Temperature As String
- Get
- Return tmp
- End Get
- End Property
- Public ReadOnly Property WindSpeed As String
- Get
- Return wnd
- End Get
- End Property
- Public ReadOnly Property WindDirection As String
- Get
- Return wnddir
- End Get
- End Property
- Public ReadOnly Property RealFeal As String
- Get
- Return rlfl
- End Get
- End Property
- Public ReadOnly Property Humidity As Integer
- Get
- Return humid
- End Get
- End Property
- Public ReadOnly Property Visibility As Integer
- Get
- Return visib
- End Get
- End Property
- Public ReadOnly Property Precipitation As Integer
- Get
- Return precip
- End Get
- End Property
- Public ReadOnly Property UVIndex As String
- Get
- Return uvindx
- End Get
- End Property
- Public ReadOnly Property DewPoint As Integer
- Get
- Return dwpnt
- End Get
- End Property
- Public ReadOnly Property CloudCover As Integer
- Get
- Return clcover
- End Get
- End Property
- Public ReadOnly Property WindChill As Integer
- Get
- Return wchill
- End Get
- End Property
- Public Sub New(ByVal cnd As String, tmp2 As String, wnd2 As String, wnddir2 As String, rld As String, hum As String, vis As String, prec As String, uvn As String, dwn As String, clc As String, wc As String)
- cond = cnd
- tmp = tmp2
- wnd = wnd2
- wnddir = wnddir2
- rlfl = rld
- humid = hum
- visib = vis
- precip = prec
- uvindx = uvn
- dwpnt = dwn
- clcover = clc
- wchill = wc
- End Sub
- End Class
- Public Class ForecastCondition
- Dim dh As Integer
- Dim dl As Integer
- Dim drh As Integer
- Dim drl As Integer
- Dim ddwnspd As Integer
- Dim ddwndir As String
- Dim dramound As Integer
- Dim dsamound As Integer
- Dim diamound As Integer
- Dim dpamount As Integer
- Dim dtstormamount As Integer
- Dim nh As Integer
- Dim nl As Integer
- Dim nrh As Integer
- Dim nrl As Integer
- Dim ndwnspd As Integer
- Dim ndwndir As String
- Dim nramound As Integer
- Dim nsamound As Integer
- Dim niamound As Integer
- Dim npamount As Integer
- Dim ntstormamount As Integer
- Dim daycod As String
- Public ReadOnly Property Day As String
- Get
- Return daycod
- End Get
- End Property
- Public ReadOnly Property DayTime As DayTimer
- Get
- Return New DayTimer(dh, dl, drh, drl, ddwnspd, ddwndir, dramound, dsamound, diamound, dpamount, dtstormamount)
- End Get
- End Property
- Public ReadOnly Property NightTime As NightTimer
- Get
- Return New NightTimer(nh, nl, nrh, nrl, ndwnspd, ndwndir, nramound, nsamound, niamound, npamount, ntstormamount)
- End Get
- End Property
- Public Sub New(ddh As Integer, dll As Integer, ddrh As Integer, ddrl As Integer, dddwnspd As Integer, dddwndir As String, ddramound As Integer, ddsamound As Integer, ddiamound As Integer, ddpamount As Integer, ddta As Integer _
- , nnh As Integer, nnl As Integer, ndrh As Integer, ndrl As Integer, nwndspd As Integer, nwnddir As String, ndramount As Integer, ndsamound As Integer, ndiamound As Integer, ndpamound As Integer, ndta As Integer _
- , dayc As String)
- dh = ddh
- dl = dll
- drh = ddrh
- drl = ddrl
- ddwnspd = dddwnspd
- ddwndir = dddwndir
- dramound = ddramound
- dsamound = ddsamound
- diamound = ddiamound
- dpamount = ddpamount
- dtstormamount = ddta
- nh = nnh
- nl = nnl
- nrh = ndrh
- nrl = ndrl
- ndwnspd = nwndspd
- ndwndir = nwnddir
- nramound = ndramount
- nsamound = ndsamound
- niamound = ndiamound
- npamount = ndpamound
- ntstormamount = ndta
- daycod = dayc
- End Sub
- Class DayTimer
- Dim h As Integer
- Dim l As Integer
- Dim rh As Integer
- Dim rl As Integer
- Dim dwnspd As Integer
- Dim dwndir As String
- Dim ramound As Integer
- Dim samound As Integer
- Dim iamound As Integer
- Dim pamound As Integer
- Dim tstormamound As Integer
- Public ReadOnly Property High As Integer
- Get
- Return h
- End Get
- End Property
- Public ReadOnly Property Low As Integer
- Get
- Return l
- End Get
- End Property
- Public ReadOnly Property RealFeelHigh As Integer
- Get
- Return rh
- End Get
- End Property
- Public ReadOnly Property WindSpeed As Integer
- Get
- Return dwnspd
- End Get
- End Property
- Public ReadOnly Property WindDirection As String
- Get
- Return dwndir
- End Get
- End Property
- Public ReadOnly Property RainAmount As Integer
- Get
- Return ramound
- End Get
- End Property
- Public ReadOnly Property SnowAmount As Integer
- Get
- Return samound
- End Get
- End Property
- Public ReadOnly Property IceAmount As Integer
- Get
- Return iamound
- End Get
- End Property
- Public ReadOnly Property Precipitation As Integer
- Get
- Return pamound
- End Get
- End Property
- Public ReadOnly Property ThunderstormPropebility As Integer
- Get
- Return tstormamound
- End Get
- End Property
- Public Sub New(hi As Integer, lo As Integer, rhi As Integer, hlo As Integer, wndspd As Integer, wnddir As String, r As Integer, s As Integer, i As Integer, p As Integer, ta As Integer)
- h = hi
- l = lo
- rh = rhi
- rl = hlo
- dwnspd = wndspd
- dwndir = wnddir
- ramound = r
- samound = s
- iamound = i
- pamound = p
- tstormamound = ta
- End Sub
- End Class
- Class NightTimer
- Dim h As Integer
- Dim l As Integer
- Dim rh As Integer
- Dim rl As Integer
- Dim dwnspd As Integer
- Dim dwndir As String
- Dim ramound As Integer
- Dim samound As Integer
- Dim iamound As Integer
- Dim pamound As Integer
- Dim tstormamound As Integer
- Public ReadOnly Property High As Integer
- Get
- Return h
- End Get
- End Property
- Public ReadOnly Property Low As Integer
- Get
- Return l
- End Get
- End Property
- Public ReadOnly Property RealFeelHigh As Integer
- Get
- Return rh
- End Get
- End Property
- Public ReadOnly Property WindSpeed As Integer
- Get
- Return dwnspd
- End Get
- End Property
- Public ReadOnly Property WindDirection As String
- Get
- Return dwndir
- End Get
- End Property
- Public ReadOnly Property RainAmount As Integer
- Get
- Return ramound
- End Get
- End Property
- Public ReadOnly Property SnowAmount As Integer
- Get
- Return samound
- End Get
- End Property
- Public ReadOnly Property IceAmount As Integer
- Get
- Return iamound
- End Get
- End Property
- Public ReadOnly Property Precipitation As Integer
- Get
- Return pamound
- End Get
- End Property
- Public ReadOnly Property ThunderstormPropebility As Integer
- Get
- Return tstormamound
- End Get
- End Property
- Public Sub New(hi As Integer, lo As Integer, rhi As Integer, hlo As Integer, wndspd As Integer, wnddir As String, r As Integer, s As Integer, i As Integer, p As Integer, ta As Integer)
- h = hi
- l = lo
- rh = rhi
- rl = hlo
- dwnspd = wndspd
- dwndir = wnddir
- ramound = r
- samound = s
- iamound = i
- pamound = p
- tstormamound = ta
- End Sub
- End Class
- End Class
- Public Class ForecastCollection
- Inherits CollectionBase
- Public Overridable Sub Add(ByVal frday As ForecastCondition)
- Me.List.Add(frday)
- End Sub
- End Class
- #End Region
- #Region "Properties"
- Dim locat As String
- Dim cond As String
- Dim tmp As String
- Dim wnd As String
- Dim wnddir As String
- Dim rlfl As String
- Dim humid As Integer
- Dim visib As Integer
- Dim precip As Integer
- Dim uvindx As String
- Dim dwpnt As Integer
- Dim clcover As Integer
- Dim wchill As Integer
- Dim fconditionlist As New ForecastCollection
- Public ReadOnly Property Current As CurrentConditions
- Get
- Return New CurrentConditions(cond, tmp, wnd, wnddir, rlfl, humid, visib, precip, uvindx, dwpnt, clcover, wchill)
- End Get
- End Property
- Public ReadOnly Property Forecast As ForecastCollection
- Get
- Return fconditionlist
- End Get
- End Property
- #End Region
- #Region "Functions"
- Private Function getconditions()
- Dim wbreq As WebRequest = WebRequest.Create("http://asus1.accu-weather.com/widget/asus1/weather-data.asp?location=" & locat & "&metric=1&langId=1")
- Dim wbresp As WebResponse = wbreq.GetResponse
- Dim strreader As New StreamReader(wbresp.GetResponseStream)
- Dim xmlfile As String = strreader.ReadToEnd.Replace("<?xml version=""1.0"" encoding=""utf-8""?>", "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes"" ?>")
- Dim xmldoc As New XmlDocument
- xmldoc.LoadXml(xmlfile)
- cond = xmldoc.SelectSingleNode("adc_database/currentconditions/weathertext").InnerText
- tmp = xmldoc.SelectSingleNode("adc_database/currentconditions/temperature").InnerText
- wnd = xmldoc.SelectSingleNode("adc_database/currentconditions/windspeed").InnerText
- wnddir = xmldoc.SelectSingleNode("adc_database/currentconditions/winddirection").InnerText
- rlfl = xmldoc.SelectSingleNode("adc_database/currentconditions/realfeel").InnerText
- humid = xmldoc.SelectSingleNode("adc_database/currentconditions/humidity").InnerText
- visib = xmldoc.SelectSingleNode("adc_database/currentconditions/visibility").InnerText
- precip = xmldoc.SelectSingleNode("adc_database/currentconditions/precip").InnerText
- uvindx = xmldoc.SelectSingleNode("adc_database/currentconditions/uvindex").Attributes("index").InnerText & " - " & xmldoc.SelectSingleNode("/adc_database/currentconditions/uvindex").InnerText
- dwpnt = xmldoc.SelectSingleNode("adc_database/currentconditions/dewpoint").InnerText
- clcover = xmldoc.SelectSingleNode("adc_database/currentconditions/cloudcover").InnerText
- wchill = xmldoc.SelectSingleNode("adc_database/currentconditions/windchill").InnerText
- For Each nod As XmlNode In xmldoc.SelectNodes("/adc_database/forecast/day")
- Dim dh As Integer
- Dim dl As Integer
- Dim drh As Integer
- Dim drl As Integer
- Dim ddwnspd As Integer
- Dim ddwndir As String
- Dim dramound As Integer
- Dim dsamound As Integer
- Dim diamound As Integer
- Dim dpamount As Integer
- Dim dtstormamount As Integer
- Dim nh As Integer
- Dim nl As Integer
- Dim nrh As Integer
- Dim nrl As Integer
- Dim ndwnspd As Integer
- Dim ndwndir As String
- Dim nramound As Integer
- Dim nsamound As Integer
- Dim niamound As Integer
- Dim npamount As Integer
- Dim ntstormamount As Integer
- Dim daycod As String
- Dim dt As XmlNode = nod.SelectSingleNode("daytime")
- dh = dt.SelectSingleNode("hightemperature").InnerText
- dl = dt.SelectSingleNode("lowtemperature").InnerText
- drh = dt.SelectSingleNode("realfeelhigh").InnerText
- drl = dt.SelectSingleNode("realfeellow").InnerText
- ddwnspd = dt.SelectSingleNode("windspeed").InnerText
- ddwndir = dt.SelectSingleNode("winddirection").InnerText
- dramound = dt.SelectSingleNode("rainamount").InnerText
- dsamound = dt.SelectSingleNode("snowamount").InnerText
- diamound = dt.SelectSingleNode("iceamount").InnerText
- dpamount = dt.SelectSingleNode("precipamount").InnerText
- dtstormamount = dt.SelectSingleNode("tstormprob").InnerText
- Dim nt As XmlNode = nod.SelectSingleNode("nighttime")
- nh = nt.SelectSingleNode("hightemperature").InnerText
- nl = nt.SelectSingleNode("lowtemperature").InnerText
- nrh = nt.SelectSingleNode("realfeelhigh").InnerText
- nrl = nt.SelectSingleNode("realfeellow").InnerText
- ndwnspd = nt.SelectSingleNode("windspeed").InnerText
- ndwndir = nt.SelectSingleNode("winddirection").InnerText
- nramound = nt.SelectSingleNode("rainamount").InnerText
- nsamound = nt.SelectSingleNode("snowamount").InnerText
- niamound = nt.SelectSingleNode("iceamount").InnerText
- npamount = nt.SelectSingleNode("precipamount").InnerText
- ntstormamount = nt.SelectSingleNode("tstormamount").InnerText
- daycod = nod.SelectSingleNode("daycode").InnerText
- fconditionlist.Add(New ForecastCondition(dh, dl, drh, drl, ddwnspd, ddwndir, dramound, dsamound, diamound, dpamount, dtstormamount, nh, nl, nrh, nrl, ndwnspd, ndwndir, nramound, nsamound, niamound, npamount, ntstormamount, daycod))
- Next
- End Function
- #End Region
- End Class