0

我只是想在这里解析一个 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&#038;blog=41877065&#038;post=92&#038;subd=belvederecollegeac&#038;ref=&#038;feed=1" width="1" height="1" />
]]>
</description>

我的feed.Items收藏似乎没有附加对象,称为描述?

4

1 回答 1

0

没有描述属性。使用摘要属性。它在以下文档中进行了描述

http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.syndicationitem.summary.aspx

“当序列化为 Atom 1.0 时,此属性将写入摘要元素。当序列化为 RSS 2.0 时,此属性将写入描述元素。”

于 2013-02-09T21:33:51.257 回答