简体   繁体   English

使用rss + c#

[英]working with rss + c#

Hi I'm trying to working with RSS feeds in C#. 嗨,我正在尝试使用C#中的RSS源。 I added RSS feeds like 我添加了RSS供稿,例如

this and this 这个这个

When I try to read into a DataSet like: 当我尝试读入DataSet像:

 ds.readxml(rsspath)

I get some tables in a DataSet. 我在数据集中得到一些表。 Now how do I know which table contains exact data of all the products? 现在我如何知道哪个表包含所有产品的确切数据?

I'm not getting products list if I write: 如果我写了,我没有得到产品清单:

gv.datasource = ds.tables[0]

Any help or suggestions? 有什么帮助或建议吗?

XmlDocument + XPath或Linq2Xml应该是处理数据的更好方法

您也可以尝试RSS.NET

也许您应该改为检出System.ServiceModel.Syndication命名空间?

This is example code puts your RSS Feed into a collection of Syndication Items: 这是示例代码,将您的RSS Feed放入联合项目集合中:

Using statements: 使用语句:

using System.ServiceModel.Syndication;
using System.Xml;

Actual code: 实际代码:

string url = "http://www.amazon.com/rss/tag/blu-ray/new/ref=tag_rsh_hl_ersn_brp?%5Fencoding=UTF8&length=10";
XmlReader xmlReader = XmlReader.Create(url);
IEnumerable<SyndicationItem> items;
items = SyndicationFeed.Load(xmlReader).Items;

Yes try Linq2Xml. 是的,请尝试Linq2Xml。 Here is an article that elaborates on both creating and consuming despite the title. 这是一篇尽管标题仍在详细说明创建和使用的文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM