bonjour,

je recupère d'un web service ce xml:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
- <channel>
  <title>Yahoo! Weather - Tournai, BE</title> 
  <link>http://us.rd.yahoo.com/dailynews/rss/weather/Tournai__BE/*http://weather.yahoo.com/forecast/FRNC0979_c.html</link> 
  <description>Yahoo! Weather for Tournai, BE</description> 
  <language>en-us</language> 
  <lastBuildDate>Wed, 15 Jan 2014 9:29 pm CET</lastBuildDate> 
  <ttl>60</ttl> 
  <yweather:location city="Tournai" region="" country="Belgium" /> 
  <yweather:units temperature="C" distance="km" pressure="mb" speed="km/h" /> 
  <yweather:wind chill="4" direction="170" speed="22.53" /> 
  <yweather:atmosphere humidity="93" visibility="9.99" pressure="982.05" rising="2" /> 
  <yweather:astronomy sunrise="8:43 am" sunset="5:11 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 Tournai, BE at 9:29 pm CET</title> 
  <geo:lat>50.62</geo:lat> 
  <geo:long>3.41</geo:long> 
  <link>http://us.rd.yahoo.com/dailynews/rss/weather/Tournai__BE/*http://weather.yahoo.com/forecast/FRNC0979_c.html</link> 
  <pubDate>Wed, 15 Jan 2014 9:29 pm CET</pubDate> 
  <yweather:condition text="Cloudy" code="26" temp="8" date="Wed, 15 Jan 2014 9:29 pm CET" /> 
- <description>
- <![CDATA[ <img src="http://l.yimg.com/a/i/us/we/52/26.gif"/><br />
<b>Current Conditions:</b><br />
Cloudy, 8 C<BR />
<BR /><b>Forecast:</b><BR />
Wed - Light Rain Late. High: 7 Low: 7<br />
Thu - AM Light Rain. High: 9 Low: 6<br />
Fri - Partly Cloudy. High: 9 Low: 4<br />
Sat - Cloudy. High: 9 Low: 5<br />
Sun - Scattered Showers. High: 9 Low: 3<br />
<br />
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Tournai__BE/*http://weather.yahoo.com/forecast/FRNC0979_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="Wed" date="15 Jan 2014" low="7" high="7" text="Light Rain Late" code="11" /> 
  <yweather:forecast day="Thu" date="16 Jan 2014" low="6" high="9" text="AM Light Rain" code="11" /> 
  <yweather:forecast day="Fri" date="17 Jan 2014" low="4" high="9" text="Partly Cloudy" code="30" /> 
  <yweather:forecast day="Sat" date="18 Jan 2014" low="5" high="9" text="Cloudy" code="26" /> 
  <yweather:forecast day="Sun" date="19 Jan 2014" low="3" high="9" text="Scattered Showers" code="39" /> 
  <guid isPermaLink="false">FRNC0979_2014_01_19_7_00_CET</guid> 
  </item>
  </channel>
  </rss>
- <!--  fan1685.sports.bf1.yahoo.com Wed Jan 15 20:54:18 PST 2014 
  -->
Ensuite je le traite pour extraire le noeud forecast je procède comme ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
 XmlDocument doc = new XmlDocument();
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
            nsmgr.AddNamespace("ns", "yweather:");
            doc.Load(responseStream);
 
            //TODO: extract temperature
           XmlNode nodeItem = doc.SelectSingleNode("/rss/channel/item/ns:forecast", nsmgr);
si je change :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
 XmlNode nodeItem = doc.SelectSingleNode("/rss/channel/item/ns:forecast", nsmgr);
par :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
 XmlNode nodeItem = doc.SelectSingleNode("/rss/channel/item/title", nsmgr);
là sa fonctionne. Et pour le geo:lat et geo:lon aussi.

Merci pour votre aide