开发者

Question on SyndicationItem - ASP.NET

开发者 https://www.devze.com 2022-12-31 03:34 出处:网络
I am trying to understand how to use SyndicationItem to display feed which is RSS 2.0 or Atom compliant.

I am trying to understand how to use SyndicationItem to display feed which is RSS 2.0 or Atom compliant.

What property of SyndicationItem gives me the entire description of the post. It appears that there is a Summary property but per MSDN, it gives only the Summary. Also I have noticed that in my RSS feed reader, some RSS feeds show only a few lines of description and I have to click and go to the website for the full post. But in some feeds, I can see the full post within the Feed Reader.

Can someone explain how all this comes together?

PS: My web page lets user enter a RSS feed address and I need to va开发者_开发百科lidate if the feed exists. If it does, I need to grab the last x items and show the feed's title and full description

EDIT

        XmlReader reader = XmlReader.Create("http://feeds.encosia.com/Encosia");
        SyndicationFeed feed = SyndicationFeed.Load(reader);

        foreach (var item in feed.Items)
        {
            Console.WriteLine(item.Title.Text);
            Console.WriteLine(item.PublishDate.ToString("dd/MM/yyyy"));
            Console.WriteLine(item.Summary.Text);
            Console.WriteLine();
        }

        reader.Close();

The first post's title, date and summary is:

I'm giving away 10 free months of TekPub this week 17/05/2010 If you follow me on Twitter, this stack of free TekPub trials may look familiar: Each card is redeemable for a one-month membership at TekPub, which allows free, unrestricted access to all of the videos on the site. Of course, that also incl udes access to my TekPub series, Mastering jQuery. I've given many of them away [...]

###

Originally posted at Encosia. If you're rea ding this elsewhere, come on over and see the original.

I’m giving away 10 free months of TekPub this week

If you go to the RSS feed, you will see that the post is longer than the output above


Have you tried the Content property?

Gets and sets the content of the syndication item.

There are separate properties for Title, Summary etc. There's not one property or method that return all the information for the item.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号