问题
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