This page last changed on Mar 28, 2013 by hank.


Since Google weather information API no longer works, i want to use instead.

I want to extract information from below site:ästra_Götaland/Torslanda/forecast.xml

To view it please checkästra_Götaland/Torslanda/

I guess i should use a HTTP command and add the adress to URL.
I think to use "GET" in "Http Method", but what should i write in "Xpath Expression" to get let´s say the temperature value for example today etc.

Best Regards

Torslanda.png (image/png)

That URL does not return a URL. Sites like the one you refer to are not very well suited for parsing.
There is a site where you can register and get access to a wheater report in XML. I don't remember how you get it.
Look at that site if it fits you. If you have problems with the XPATH, I am happy to help (Parsing this kind of data is on my longer term agenda anyhow.)

Posted by pz1 at Mar 28, 2013 15:37

Thanks Pe Zanstra for your quick replay.

Explain for me what you mean with "That URL does not return a URL"ästra_Götaland/Torslanda/forecast.xml
I´m a newbie with XML, so the above link doesn´t give you a good XML site?

Wunderground is a good alternative but doesn´t have weather info at my area so good.

Posted by hank at Mar 28, 2013 15:43

Sorry, I missed the first URL. I am busy right now, but will give you an example for the Xpath later tonight

Posted by pz1 at Mar 28, 2013 16:08

Thanks for your support, I try to learn step by step how to get the most out of OR.

Posted by hank at Mar 28, 2013 16:11

This xml is more complex than I ever handled before. So I couldn't find a quick solution. The Wunderground site I use gives me simple real time information. Yours has several more or less identical periods. Do you need all the information for the multiple time slots? (edit: added xml header which was invisible in browser)

<?xml version="1.0" encoding="utf-8"?>
    <timezone id="Europe/Stockholm" utcoffsetMinutes="60" />
    <location altitude="26" latitude="57.72432" longitude="11.77013" geobase="geonames" geobaseid="2667809" />
....lines removed
      <time from="2013-03-28T19:00:00" to="2013-03-29T00:00:00" period="3">
        <!-- Valid from 2013-03-28T19:00:00 to 2013-03-29T00:00:00 -->
        <symbol number="3" name="Partly cloudy" var="mf/03n.54" />
        <precipitation value="0" />
        <!-- Valid at 2013-03-28T19:00:00 -->
        <windDirection deg="352.2" code="N" name="North" />
        <windSpeed mps="3.5" name="Gentle breeze" />
        <temperature unit="celsius" value="1" />
        <pressure unit="hPa" value="1019.5" />
      <time from="2013-03-29T00:00:00" to="2013-03-29T06:00:00" period="0">
        <!-- Valid from 2013-03-29T00:00:00 to 2013-03-29T06:00:00 -->
        <symbol number="2" name="Fair" var="mf/02n.58" />
        <precipitation value="0" />
        <!-- Valid at 2013-03-29T00:00:00 -->
        <windDirection deg="103.1" code="ESE" name="East-southeast" />
        <windSpeed mps="4.9" name="Gentle breeze" />
        <temperature unit="celsius" value="-2" />
        <pressure unit="hPa" value="1018.5" />
      <time from="2013-03-29T00:00:00" to="2013-03-29T06:00:00" period="0">

Afaik the Xpath to get the name off the location should be


Can't get that to work, while I have similar example:


That works well with XPATH

Posted by pz1 at Mar 28, 2013 18:53

Maybe because they have a typo in their tag name? <wheatherdata>

Posted by admin at Mar 29, 2013 04:02

You got me! That was a misspelling on my side in the example as represented here. In my post I here typed the XPATH from the top of my head
Edit: I double checked with the original sources, and adapted my post above.

Posted by pz1 at Mar 29, 2013 08:12

I got one step further. I did copy the forecast.xml contents to the Openremote/webapps/private subdirectory of my controller:

Now the location information does appear on screen. So apparently the XML from the Swedish site is somehow different from the file I read through Tomcat from my private directory. (I vaguely remember having had this experience before but did not yet find a note about that in my piles)

I can now also read the first occurrence of windSpeed, which is held in an attribute named mps. Attributes are referenced via an "@", The XPATH has to be:


I have as yet to find out how to select the n-th occurrence. (And the issue with the live XML of course)

Posted by pz1 at Mar 29, 2013 11:30

Sorry not to hear back from you

Posted by pz1 at Apr 04, 2013 08:15

Sorry fro my lack of response PE ZANSTRA.
I has been traveling for some days now and didn´t have the oportunity to test your progress.
Thanks alot for your help I really would like to get info about the weather from this XML.

Do you need to copy the XML file to your harddrive to been able to read it?

Best Regards

Posted by hank at Apr 04, 2013 08:20

When you use //@mps in XPATH you get the first comming windspeed?

Posted by hank at Apr 04, 2013 08:21

Indeed, you do get the first occurence. I vaguely remember someone dealing with the n-th occurence last year, but I haven't been able yet to spot that.
As you can see from my previous posts I did manage to get a copy on my local server, and get it to work from there.
In getting through old threads I also found that some of the XPATH stuff did work on an older version, but not on a newer. I have not tracked if that has anything to do with your problem, or that this has been resolved in the mean time.

Another question I raised was what you actually want to achien with thes wheatherdata?

Posted by pz1 at Apr 04, 2013 08:28

Hi Pieter

I try to create my own look a like Gira Home Server interface.
What i want to achive is to been able just to display the weather for 5-days.

Needed data to read:
-Symbol number
-Name of the weather


Posted by hank at Apr 04, 2013 08:48

I found the solution for the selection of the n-th occurence of a value. In your specific case for the wind speed try the following XPATH expression if you want the second measurement:

Posted by pz1 at May 19, 2013 19:52

Great news PE ZANSTRA.
Now I can continue my work with the weather data.

I guess i just use:
to get the temp for the 2nd entery?

Posted by hank at May 20, 2013 11:38



should work.
Please note that I still can not read it directly from the address you gave. I have to copy the xml to my machine first. May have to do with diacritical characters in the URL. I haven't looked into that any further though.

I am in the process of writing a small Howto for Xpath. Unfortunately I don't know yet how to make that visible for users.

Posted by pz1 at May 20, 2013 11:52

Here is the page that describes how to deal with XPath

Posted by pz1 at May 26, 2013 12:26

Did you manage to get this working directly from the wheather URL in the meantime?

Posted by pz1 at Jun 12, 2013 23:23


It works perfectly for me directly from the URL, i don´t need to download the XML.
Your work has been very important to me, Thanks!

The only problem is that i don´t had time to work with my project lately.

I will let you know my progress as soon as im up and running again!

Best Regards

Posted by hank at Jun 13, 2013 08:03

Thanks for the confirmation

Posted by pz1 at Jun 13, 2013 08:05
Document generated by Confluence on Jun 05, 2016 09:30