0
我想阅读RSS提要的特定行,以使用visual C#在标签中显示信息。以下给出的是Rss源。如何在Visual C#中读取RSS提要的特定行
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel>
<title>Weather Underground</title>
<link>http://www.wunderground.com/</link>
<category>weather</category>
<item>
<title>Current Conditions : 28C, Mostly Cloudy - 9:10 AM IST Jun. 28</title>
<link>http://www.wunderground.com/global/stations/43466.html</link>
<description><![CDATA[Temperature: 28°C | Humidity: 79% | Pressure: 1011hPa (Steady) | Conditions: Mostly Cloudy | Wind Direction: SW | Wind Speed: 15km/h<img src="http://server.as5000.com/AS5000/adserver/image?ID=WUND-00071&C=0" width="0" height="0" border="0"/>]]>
</description>
<pubDate>Thu, 28 Jun 2012 09:10:00 IST</pubDate>
</item>
<item>
<title>Forecast for Wednesday Night as of Jun. 27 5:30 PM IST</title>
<link>http://www.wunderground.com/global/stations/43466.html</link>
<description>
Chance of a Thunderstorm. Low:26 &deg; C.
</description>
<pubDate>Wed, 27 Jun 2012 12:00:00 GMT</pubDate>
<guid isPermaLink="false">1340798400-1-night</guid>
</item>
<item>
<title>Forecast for Thursday as of Jun. 27 5:30 PM IST</title>
<link>http://www.wunderground.com/global/stations/43466.html</link>
<description>
Chance of a Thunderstorm. High:31 &deg; C.//This is the line that I need
</description>
<pubDate>Wed, 27 Jun 2012 12:00:00 GMT</pubDate>
<guid isPermaLink="false">1340884800-2-day</guid>
</item>
有在这个XML文件我怎么指的是一个,我需要和获取描述标签内的文本许多项目的标签?
得到具体的描述。当我这样做的:var RSS = XDocument.Load(“你的RSS文件”);它说不能将void分配给隐式类型的局部变量。 –
试试这个XDocument rss = XDocument.Load(“你的rss文件”); –
谢谢。现在我已经把错误的重要陈述包括在内了。但还有另一件事说它的名称'项目'不存在于当前上下文中:Title =(string)item.Element(“description”) –