下面是雅虎天气返回的一个XML文件,
string Url = "http://xml.weather.yahoo.com/forecastrss?u=c&p=CHXX0016";
MSXML2.XMLHTTP _xmlhttp = new MSXML2.XMLHTTPClass();
_xmlhttp.open("GET", Url, true, null, null);
_xmlhttp.send("");
我相取得
<yweather:forecast day="Wed" date="26 Mar 2008" low="13" high="23" text="Partly Cloudy" code="30" />
<yweather:forecast day="Thu" date="27 Mar 2008" low="13" high="22" text="Showers" code="11" />
<yweather:forecast day="Fri" date="28 Mar 2008" low="12" high="19" text="Showers" code="11" />
<yweather:forecast day="Sat" date="29 Mar 2008" low="11" high="15" text="Showers" code="11" />
<yweather:forecast day="Sun" date="30 Mar 2008" low="11" high="17" text="Showers" code="11" />
这部分中的day,low,high,text,code的值,谁能帮忙写个正则或其它方法取得他们的值<item>
<title>Conditions for Chengdu, CH at 2:00 pm CST</title>
<geo:lat>30.67</geo:lat>
<geo:long>104.02</geo:long>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Chengdu__CH/*http://weather.yahoo.com/forecast/CHXX0016_c.html</link>
<pubDate>Wed, 26 Mar 2008 2:00 pm CST</pubDate>
<yweather:condition  text="Fair"  code="34"  temp="24"  date="Wed, 26 Mar 2008 2:00 pm CST" />
<description><![CDATA[
<img src="http://l.yimg.com/us.yimg.com/i/us/we/52/34.gif"/><br />
<b>Current Conditions:</b><br />
Fair, 24 C<BR />
<BR /><b>Forecast:</b><BR />
Wed - Partly Cloudy. High: 23 Low: 13<br />
Thu - Showers. High: 22 Low: 13<br />
Fri - Showers. High: 19 Low: 12<br />
Sat - Showers. High: 15 Low: 11<br />
Sun - Showers. High: 17 Low: 11<br />
<br />
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Chengdu__CH/*http://weather.yahoo.com/forecast/CHXX0016_c.html">Full Forecast at Yahoo! Weather</a><BR/>
(provided by The Weather Channel)<br/>
]]></description>
<yweather:forecast day="Wed" date="26 Mar 2008" low="13" high="23" text="Partly Cloudy" code="30" />
<yweather:forecast day="Thu" date="27 Mar 2008" low="13" high="22" text="Showers" code="11" />
<yweather:forecast day="Fri" date="28 Mar 2008" low="12" high="19" text="Showers" code="11" />
<yweather:forecast day="Sat" date="29 Mar 2008" low="11" high="15" text="Showers" code="11" />
<yweather:forecast day="Sun" date="30 Mar 2008" low="11" high="17" text="Showers" code="11" />
<guid isPermaLink="false">CHXX0016_2008_03_26_14_00_CST</guid>
</item>
</channel>