反序列化在.NET中一个RSS feed [英] Deserializing an RSS feed in .NET

查看:138
本文介绍了反序列化在.NET中一个RSS feed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时它的实际/可以使用序列从一个RSS源中读取数据?我基本上是想从我的Netflix队列(来自RSS源提供)提取信息,而我想,以决定是否序列化是可行的/可能的,或者我应该只使用类似的XMLReader。此外,这将是下载从URL饲料的最佳方法是什么?我从来没有拉文件从什么,但驱动器,所以我不知道如何去这样做。

Is it practical / possible to use serialization to read data from an RSS feed? I basically want to pull information from my Netflix queue (provided from an RSS feed), and I'm trying to decide if serialization is feasible / possible, or if I should just use something like XMLReader. Also, what would be the best way to download the feed from a URL? I've never pulled files from anything but drives, so I'm not sure how to go about doing that.

推荐答案

如果你能使用LINQ,LINQ到XML是一种简单的方法来获得的RSS源文件的基本知识。

If you can use LINQ, LINQ to XML is an easy way to get at the basics of an RSS feed document.

这是从<一个href="http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/">something我写了从我的博客的RSS Feed选择了匿名类型的集合,例如:

This is from something I wrote to select out a collection of anonymous types from my blog's RSS feed, for example:

protected void Page_Load(object sender, EventArgs e)
{
  XDocument feedXML = XDocument.Load("http://feeds.encosia.com/Encosia");

  var feeds = from feed in feedXML.Descendants("item")
              select new
              {
                Title = feed.Element("title").Value,
                Link = feed.Element("link").Value,
                Description = feed.Element("description").Value
              };

  PostList.DataSource = feeds;
  PostList.DataBind();
}

您应该能够使用的东西,对你的Netflix的饲料非常相似。

You should be able to use something very similar against your Netflix feed.

这篇关于反序列化在.NET中一个RSS feed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆