I try to read out some parameters from this xml file. There is a namespace for the yweather defined. what is the detailed syntax for this namespace. What do i have to write into NS1 and what do I have to write in the XPath expression to get the yweather:forecast values.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0" xmlns:geo="http://generated.ns/geo">
<channel>
<title>Yahoo! Weather - Beijing, CN</title>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Beijing__CN/*http://weather.yahoo.com/forecast/CHXX0008_c.html</link>
<description>Yahoo! Weather for Beijing, CN</description>
<language>en-us</language>
<lastBuildDate>Sun, 01 Sep 2013 1:59 pm CST</lastBuildDate>
<ttl>60</ttl>
<yweather:location city="Beijing" region="" country="China"/>
<yweather:units temperature="C" distance="km" pressure="mb" speed="km/h"/>
<yweather:wind chill="28" direction="180" speed="6.44"/>
<yweather:atmosphere humidity="41" visibility="" pressure="1012.2" rising="0"/>
<yweather:astronomy sunrise="5:40 am" sunset="6:47 pm"/>
<image>
<title>Yahoo! Weather</title>
<width>142</width>
<height>18</height>
<link>http://weather.yahoo.com</link>
<url>http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif</url>
</image>
<item>
<title>Conditions for Beijing, CN at 1:59 pm CST</title>
<geo:lat>39.91</geo:lat>
<geo:long>116.39</geo:long>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Beijing__CN/*http://weather.yahoo.com/forecast/CHXX0008_c.html</link>
<pubDate>Sun, 01 Sep 2013 1:59 pm CST</pubDate>
<yweather:condition text="Partly Cloudy" code="30" temp="28" date="Sun, 01 Sep 2013 1:59 pm CST"/>
<description><![CDATA[
<img src="http://l.yimg.com/a/i/us/we/52/30.gif"/><br />
<b>Current Conditions:</b><br />
Partly Cloudy, 28 C<BR />
<BR /><b>Forecast:</b><BR />
Sun - Mostly Sunny. High: 28 Low: 17<br />
Mon - Sunny. High: 28 Low: 16<br />
Tue - Partly Cloudy. High: 27 Low: 18<br />
Wed - Scattered Thunderstorms. High: 25 Low: 17<br />
Thu - Showers. High: 21 Low: 15<br />
<br />
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Beijing__CN/*http://weather.yahoo.com/forecast/CHXX0008_c.html">Full Forecast at Yahoo! Weather</a><BR/><BR/>
(provided by <a href="http://www.weather.com" >The Weather Channel</a>)<br/>
]]></description>
<yweather:forecast day="Sun" date="1 Sep 2013" low="17" high="28" text="Mostly Sunny" code="34"/>
<yweather:forecast day="Mon" date="2 Sep 2013" low="16" high="28" text="Sunny" code="32"/>
<yweather:forecast day="Tue" date="3 Sep 2013" low="18" high="27" text="Partly Cloudy" code="30"/>
<yweather:forecast day="Wed" date="4 Sep 2013" low="17" high="25" text="Scattered Thunderstorms" code="38"/>
<yweather:forecast day="Thu" date="5 Sep 2013" low="15" high="21" text="Showers" code="11"/>
<guid isPermaLink="false">CHXX0008_2013_09_05_7_00_CST</guid>
</item>
</channel>
</rss>
<!-- api25.weather.bf1.yahoo.com Sun Sep 1 07:14:59 PST 2013 -->
Thx