我只想在这里解析一个RSS提要,我可以用XmlReader来做这个
String blogrss = @"http://belvederecollegeac.wordpress.com/feed/";
using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(blogrss))
{
System.ServiceModel.Syndication.SyndicationFeed feed = System.ServiceModel.Syndication.SyndicationFeed.Load(reader);
foreach (var v in feed.Items)
{
string title = v.Title.Text.Replace("•", " --- ");
string url = v.Id;
string link = "<a href=" + url + ">" + title + "</a>";
Response.Write(link + "<br><br>");
}
但我找不到xml阅读器如何给我描述节点?
我可以获得v.Tite和v.Id(用于链接),但RSS包含一个描述节点,例如
<description>
<![CDATA[
Photos from the J.C.T. game v Kilkenny College can be viewed at the College website gallery page. A highlights video from the S.C.T. game v Terenure can also be viewed on the video gallery page.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=belvederecollegeac.wordpress.com&blog=41877065&post=92&subd=belvederecollegeac&ref=&feed=1" width="1" height="1" />
]]>
</description>
我的feed.Items
集合似乎没有附加到它的对象称为描述?
答案 0 :(得分:0)
没有Description属性。使用Summary属性。它在以下文档中描述
http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.syndicationitem.summary.aspx
“当序列化为Atom 1.0时,此属性将写入摘要元素。当序列化为RSS 2.0时,此属性将写入描述元素。”