Solved

Read out xml from yr.no

Posted on 2008-10-20
2
596 Views
Last Modified: 2009-04-02
How can I read out the weatherdata from this xml? http://www.yr.no/sted/Sverige/Västmanland/Kungsörs_Kommun/varsel.xml
Cant get so deep in the xml
- <weatherdata>
- <location>
  <name>Kungsörs Kommun</name> 
  <type>Administrativ inndeling</type> 
  <country>Sverige</country> 
  <timezone id="Europe/Stockholm" utcoffsetMinutes="120" /> 
  <location altitude="16" latitude="59.4333333" longitude="16.1" geobase="geonames" geobaseid="2698680" /> 
  </location>
- <links>
  <link id="xmlSource" url="http://www.yr.no/sted/Sverige/Västmanland/Kungsörs_Kommun/varsel.xml" /> 
  <link id="overview" url="http://www.yr.no/sted/Sverige/Västmanland/Kungsörs_Kommun/" /> 
  <link id="hourByHour" url="http://www.yr.no/sted/Sverige/Västmanland/Kungsörs_Kommun/time_for_time.html" /> 
  <link id="weekend" url="http://www.yr.no/sted/Sverige/Västmanland/Kungsörs_Kommun/helg.html" /> 
  <link id="longTermForecast" url="http://www.yr.no/sted/Sverige/Västmanland/Kungsörs_Kommun/langtidsvarsel.html" /> 
  <link id="radar" url="http://www.yr.no/sted/Sverige/Västmanland/Kungsörs_Kommun/radar.html" /> 
  </links>
- <meta>
  <lastupdate>2008-10-21T09:12:23</lastupdate> 
  <nextupdate>2008-10-21T18:00:00</nextupdate> 
  </meta>
- <forecast>
- <tabular>
- <time from="2008-10-21T12:00:00" to="2008-10-21T18:00:00" period="2">
- <!--  Valid from 2008-10-21T12:00:00 to 2008-10-21T18:00:00 
  --> 
  <symbol number="4" name="Skyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-21T12:00:00 
  --> 
  <windDirection deg="214.7" code="SW" name="Sørvest" /> 
  <windSpeed mps="4.4" name="Lett bris" /> 
  <temperature unit="celcius" value="11" /> 
  <pressure unit="hPa" value="996.4" /> 
  </time>
- <time from="2008-10-21T18:00:00" to="2008-10-22T00:00:00" period="3">
- <!--  Valid from 2008-10-21T18:00:00 to 2008-10-22T00:00:00 
  --> 
  <symbol number="2" name="Lettskyet" /> 
  <precipitation value="0.3" /> 
- <!--  Valid at 2008-10-21T18:00:00 
  --> 
  <windDirection deg="215.4" code="SW" name="Sørvest" /> 
  <windSpeed mps="5.3" name="Lett bris" /> 
  <temperature unit="celcius" value="10" /> 
  <pressure unit="hPa" value="995.9" /> 
  </time>
- <time from="2008-10-22T00:00:00" to="2008-10-22T06:00:00" period="0">
- <!--  Valid from 2008-10-22T00:00:00 to 2008-10-22T06:00:00 
  --> 
  <symbol number="1" name="Sol" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-22T00:00:00 
  --> 
  <windDirection deg="231.0" code="SW" name="Sørvest" /> 
  <windSpeed mps="6.9" name="Laber bris" /> 
  <temperature unit="celcius" value="9" /> 
  <pressure unit="hPa" value="998.2" /> 
  </time>
- <time from="2008-10-22T06:00:00" to="2008-10-22T12:00:00" period="1">
- <!--  Valid from 2008-10-22T06:00:00 to 2008-10-22T12:00:00 
  --> 
  <symbol number="2" name="Lettskyet" /> 
  <precipitation value="0.3" /> 
- <!--  Valid at 2008-10-22T06:00:00 
  --> 
  <windDirection deg="232.6" code="SW" name="Sørvest" /> 
  <windSpeed mps="6.0" name="Laber bris" /> 
  <temperature unit="celcius" value="7" /> 
  <pressure unit="hPa" value="1003.9" /> 
  </time>
- <time from="2008-10-22T12:00:00" to="2008-10-22T18:00:00" period="2">
- <!--  Valid from 2008-10-22T12:00:00 to 2008-10-22T18:00:00 
  --> 
  <symbol number="1" name="Sol" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-22T12:00:00 
  --> 
  <windDirection deg="238.7" code="WSW" name="Vest-sørvest" /> 
  <windSpeed mps="6.0" name="Laber bris" /> 
  <temperature unit="celcius" value="9" /> 
  <pressure unit="hPa" value="1008.9" /> 
  </time>
- <time from="2008-10-22T18:00:00" to="2008-10-23T00:00:00" period="3">
- <!--  Valid from 2008-10-22T18:00:00 to 2008-10-23T00:00:00 
  --> 
  <symbol number="2" name="Lettskyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-22T18:00:00 
  --> 
  <windDirection deg="228.2" code="SW" name="Sørvest" /> 
  <windSpeed mps="5.0" name="Lett bris" /> 
  <temperature unit="celcius" value="8" /> 
  <pressure unit="hPa" value="1011.2" /> 
  </time>
- <time from="2008-10-23T00:00:00" to="2008-10-23T06:00:00" period="0">
- <!--  Valid from 2008-10-23T00:00:00 to 2008-10-23T06:00:00 
  --> 
  <symbol number="2" name="Lettskyet" /> 
  <precipitation value="0.2" /> 
- <!--  Valid at 2008-10-23T00:00:00 
  --> 
  <windDirection deg="221.2" code="SW" name="Sørvest" /> 
  <windSpeed mps="3.8" name="Lett bris" /> 
  <temperature unit="celcius" value="6" /> 
  <pressure unit="hPa" value="1014.0" /> 
  </time>
- <time from="2008-10-23T06:00:00" to="2008-10-23T12:00:00" period="1">
- <!--  Valid from 2008-10-23T06:00:00 to 2008-10-23T12:00:00 
  --> 
  <symbol number="1" name="Sol" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-23T06:00:00 
  --> 
  <windDirection deg="237.3" code="WSW" name="Vest-sørvest" /> 
  <windSpeed mps="3.7" name="Lett bris" /> 
  <temperature unit="celcius" value="5" /> 
  <pressure unit="hPa" value="1016.5" /> 
  </time>
- <time from="2008-10-23T12:00:00" to="2008-10-23T18:00:00" period="2">
- <!--  Valid from 2008-10-23T12:00:00 to 2008-10-23T18:00:00 
  --> 
  <symbol number="2" name="Lettskyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-23T12:00:00 
  --> 
  <windDirection deg="233.2" code="SW" name="Sørvest" /> 
  <windSpeed mps="5.4" name="Lett bris" /> 
  <temperature unit="celcius" value="9" /> 
  <pressure unit="hPa" value="1018.3" /> 
  </time>
- <time from="2008-10-23T20:00:00" to="2008-10-24T02:00:00" period="3">
- <!--  Valid from 2008-10-23T20:00:00 to 2008-10-24T02:00:00 
  --> 
  <symbol number="4" name="Skyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-23T20:00:00 
  --> 
  <windDirection deg="206.4" code="SSW" name="Sør-sørvest" /> 
  <windSpeed mps="3.5" name="Lett bris" /> 
  <temperature unit="celcius" value="8" /> 
  <pressure unit="hPa" value="1017.7" /> 
  </time>
- <time from="2008-10-24T02:00:00" to="2008-10-24T08:00:00" period="0">
- <!--  Valid from 2008-10-24T02:00:00 to 2008-10-24T08:00:00 
  --> 
  <symbol number="3" name="Delvis skyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-24T02:00:00 
  --> 
  <windDirection deg="204.4" code="SSW" name="Sør-sørvest" /> 
  <windSpeed mps="4.8" name="Lett bris" /> 
  <temperature unit="celcius" value="8" /> 
  <pressure unit="hPa" value="1015.7" /> 
  </time>
- <time from="2008-10-24T08:00:00" to="2008-10-24T14:00:00" period="1">
- <!--  Valid from 2008-10-24T08:00:00 to 2008-10-24T14:00:00 
  --> 
  <symbol number="4" name="Skyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-24T08:00:00 
  --> 
  <windDirection deg="205.3" code="SSW" name="Sør-sørvest" /> 
  <windSpeed mps="4.9" name="Lett bris" /> 
  <temperature unit="celcius" value="8" /> 
  <pressure unit="hPa" value="1013.4" /> 
  </time>
- <time from="2008-10-24T14:00:00" to="2008-10-24T20:00:00" period="2">
- <!--  Valid from 2008-10-24T14:00:00 to 2008-10-24T20:00:00 
  --> 
  <symbol number="4" name="Skyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-24T14:00:00 
  --> 
  <windDirection deg="203.3" code="SSW" name="Sør-sørvest" /> 
  <windSpeed mps="6.4" name="Laber bris" /> 
  <temperature unit="celcius" value="11" /> 
  <pressure unit="hPa" value="1013.0" /> 
  </time>
- <time from="2008-10-24T20:00:00" to="2008-10-25T02:00:00" period="3">
- <!--  Valid from 2008-10-24T20:00:00 to 2008-10-25T02:00:00 
  --> 
  <symbol number="9" name="Regn" /> 
  <precipitation value="0.9" /> 
- <!--  Valid at 2008-10-24T20:00:00 
  --> 
  <windDirection deg="194.2" code="SSW" name="Sør-sørvest" /> 
  <windSpeed mps="4.6" name="Lett bris" /> 
  <temperature unit="celcius" value="10" /> 
  <pressure unit="hPa" value="1010.4" /> 
  </time>
- <time from="2008-10-25T02:00:00" to="2008-10-25T08:00:00" period="0">
- <!--  Valid from 2008-10-25T02:00:00 to 2008-10-25T08:00:00 
  --> 
  <symbol number="2" name="Lettskyet" /> 
  <precipitation value="0.5" /> 
- <!--  Valid at 2008-10-25T02:00:00 
  --> 
  <windDirection deg="204.5" code="SSW" name="Sør-sørvest" /> 
  <windSpeed mps="6.4" name="Laber bris" /> 
  <temperature unit="celcius" value="7" /> 
  <pressure unit="hPa" value="1008.9" /> 
  </time>
- <time from="2008-10-25T08:00:00" to="2008-10-25T14:00:00" period="1">
- <!--  Valid from 2008-10-25T08:00:00 to 2008-10-25T14:00:00 
  --> 
  <symbol number="9" name="Regn" /> 
  <precipitation value="0.8" /> 
- <!--  Valid at 2008-10-25T08:00:00 
  --> 
  <windDirection deg="222.9" code="SW" name="Sørvest" /> 
  <windSpeed mps="3.8" name="Lett bris" /> 
  <temperature unit="celcius" value="6" /> 
  <pressure unit="hPa" value="1010.5" /> 
  </time>
- <time from="2008-10-25T14:00:00" to="2008-10-25T20:00:00" period="2">
- <!--  Valid from 2008-10-25T14:00:00 to 2008-10-25T20:00:00 
  --> 
  <symbol number="5" name="Regnbyger" /> 
  <precipitation value="0.9" /> 
- <!--  Valid at 2008-10-25T14:00:00 
  --> 
  <windDirection deg="210.0" code="SSW" name="Sør-sørvest" /> 
  <windSpeed mps="8.9" name="Frisk bris" /> 
  <temperature unit="celcius" value="8" /> 
  <pressure unit="hPa" value="1007.6" /> 
  </time>
- <time from="2008-10-25T20:00:00" to="2008-10-26T02:00:00" period="3">
- <!--  Valid from 2008-10-25T20:00:00 to 2008-10-26T02:00:00 
  --> 
  <symbol number="1" name="Sol" /> 
  <precipitation value="0.2" /> 
- <!--  Valid at 2008-10-25T20:00:00 
  --> 
  <windDirection deg="231.3" code="SW" name="Sørvest" /> 
  <windSpeed mps="4.3" name="Lett bris" /> 
  <temperature unit="celcius" value="5" /> 
  <pressure unit="hPa" value="1007.1" /> 
  </time>
- <time from="2008-10-26T13:00:00" to="2008-10-26T19:00:00" period="2">
- <!--  Valid from 2008-10-26T13:00:00 to 2008-10-26T19:00:00 
  --> 
  <symbol number="9" name="Regn" /> 
  <precipitation value="4.0" /> 
- <!--  Valid at 2008-10-26T13:00:00 
  --> 
  <windDirection deg="182.7" code="S" name="Sør" /> 
  <windSpeed mps="5.2" name="Lett bris" /> 
  <temperature unit="celcius" value="7" /> 
  <pressure unit="hPa" value="1002.0" /> 
  </time>
- <time from="2008-10-27T13:00:00" to="2008-10-27T19:00:00" period="2">
- <!--  Valid from 2008-10-27T13:00:00 to 2008-10-27T19:00:00 
  --> 
  <symbol number="1" name="Sol" /> 
  <precipitation value="0.8" /> 
- <!--  Valid at 2008-10-27T13:00:00 
  --> 
  <windDirection deg="327.9" code="NNW" name="Nord-nordvest" /> 
  <windSpeed mps="9.7" name="Frisk bris" /> 
  <temperature unit="celcius" value="3" /> 
  <pressure unit="hPa" value="986.8" /> 
  </time>
- <time from="2008-10-28T13:00:00" to="2008-10-28T19:00:00" period="2">
- <!--  Valid from 2008-10-28T13:00:00 to 2008-10-28T19:00:00 
  --> 
  <symbol number="3" name="Delvis skyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-28T13:00:00 
  --> 
  <windDirection deg="266.5" code="W" name="Vest" /> 
  <windSpeed mps="5.0" name="Lett bris" /> 
  <temperature unit="celcius" value="4" /> 
  <pressure unit="hPa" value="1000.4" /> 
  </time>
- <time from="2008-10-29T13:00:00" to="2008-10-29T19:00:00" period="2">
- <!--  Valid from 2008-10-29T13:00:00 to 2008-10-29T19:00:00 
  --> 
  <symbol number="4" name="Skyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-29T13:00:00 
  --> 
  <windDirection deg="2.6" code="N" name="Nord" /> 
  <windSpeed mps="1.7" name="Svak vind" /> 
  <temperature unit="celcius" value="1" /> 
  <pressure unit="hPa" value="1001.4" /> 
  </time>
- <time from="2008-10-30T13:00:00" to="2008-10-30T19:00:00" period="2">
- <!--  Valid from 2008-10-30T13:00:00 to 2008-10-30T19:00:00 
  --> 
  <symbol number="3" name="Delvis skyet" /> 
  <precipitation value="0.0" /> 
- <!--  Valid at 2008-10-30T13:00:00 
  --> 
  <windDirection deg="9.5" code="N" name="Nord" /> 
  <windSpeed mps="2.4" name="Svak vind" /> 
  <temperature unit="celcius" value="1" /> 
  <pressure unit="hPa" value="1001.5" /> 
  </time>
  </tabular>
  </forecast>
  </weatherdata>

Open in new window

0
Comment
Question by:ezzet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
Tony McCreath earned 500 total points
ID: 22806850
This should get you started.

You need to work out the data you want and create XPath expressions to get to it.
<%
Dim httpReq, xmlDoc, locationName
 
' Create the http reqiest object. you may want to use a different version
Set httpReq = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0") 
 
' Create the request
Call httpReq.Open("GET", "http://www.yr.no/sted/Sverige/V%C3%A4stmanland/Kungs%C3%B6rs_Kommun/varsel.xml" , False) 
 
' send the request
httpReq.Send
 
' read the response into an XML document
Set responseDoc = httpReq.ResponseXML
 
' Read in some data using XPath syntax
locationName = responseDoc.SelectSingleNode("weatherdata/location/name").Text
 
' Display the data
Response.Write locationName
%>

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Asp in server side with Mssql Server 7 4 33
Clear input text 15 26
Validating Date Part2 2 26
Please Explain What Reading a Zip file Back In Means 11 59
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question