开发者

Parse RSS feed using asp.net c#

开发者 https://www.devze.com 2023-03-25 22:40 出处:网络
I have an RSS feed that I follow and would like to display it on my website. The UI would simply contain the description of the article in the RSS feed and also have the link to click on.

I have an RSS feed that I follow and would like to display it on my website. The UI would simply contain the description of the article in the RSS feed and also have the link to click on.

Since I'm using the ASP.NET C# framework, I'm 开发者_开发百科wondering if this has been done before.

Thanks!


The consumption (and generation) of feeds has been baked into the framework since .NET 3.5 SP1 in the System.ServiceModel.Syndication namespace.

You can consume a feed (ATOM or RSS) using the SyndicationFeed class, like this:

var reader = XmlReader.Create("http://localhost/feeds/serializedFeed.xml");
var feed = SyndicationFeed.Load(reader);

Lots of examples on MSDN - take a look at the namespace page I've linked to. Should get you started.

0

精彩评论

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

关注公众号