working with rss + c#

不打扰是莪最后的温柔 提交于 2020-01-14 04:29:12

问题


Hi I'm trying to working with RSS feeds in C#. I added RSS feeds like

this and this

When I try to read into a DataSet like:

 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?


回答1:


XmlDocument+ XPath or Linq2Xml should be a better way of handling the data




回答2:


You could also try RSS.NET.




回答3:


Maybe you should check out the System.ServiceModel.Syndication namespace instead?




回答4:


This is example code puts your RSS Feed into a collection of Syndication Items:

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;



回答5:


Yes try Linq2Xml. Here is an article that elaborates on both creating and consuming despite the title.



来源:https://stackoverflow.com/questions/1259392/working-with-rss-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!