下面是雅虎天气返回的一个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>
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>
解决方案 »
- 密码中 ' 的问题
- 关于TreeView无限分类帮顶的问题
- 数据库中列为int型,在.NET下如何把一个变量与该字段为空时对应起来?
- asp.net 如何为CheckBoxList控件中的每一个CheckBox 添加事件
- 我做好的ASPX网站在服务器上不能运行,请问是怎么回事儿,提示在帖子里面!!请高手帮我看看,急!!!
- DropDownList控件的问题。
- gridview嵌套出现隔行显示,内层的gridview
- 急!!关于DataList操作的问题
- ASP.NET MVC4 新增和修改时不同验证问题
- MVC5自动装配时提示(没有给该对象定义无参数的构造函数)?
- CSDN生成帖子功能是怎么做的?
- 哪位朋友能给份Microsoft Visual SourceSafe 2005的详细使用指南
这种切点读取的时候要报错,可以是应为:是特殊符号的原因