问题
I' trying to read the feed for the Washington Departmene of Fish and Wildlife, and keep etting this error:
The element with name 'RDF' and namespace 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' is not an allowed feed format.
Here's the code from RssController:
public virtual ActionResult Index()
{
string feedUrl = @"http://wdfw.wa.gov/news/newsrss.php";
using (XmlReader reader = XmlReader.Create(feedUrl))
{
**SyndicationFeed rss = SyndicationFeed.Load(reader);**
return View(rss);
}
}
I've done seveal RSS applications but nave never ran into this issue. Anyone got any concrete ways of being able to parse this in ASP.NET MVC 2? (the lines with asterics are where the exception happens.
回答1:
There's no support for RSS 1.0. Example of how to roll your own support here : http://www.4guysfromrolla.com/articles/031809-1.aspx
回答2:
This may not be applicable to you as it sounds like you are only interested in RSS, but if you want RDF support for your application (RSS 1.0 uses RDF/XML to encode it's data) then you could try my library dotNetRDF.
I suspect that a full blown RDF API is probably overkill though judging from your question.
来源:https://stackoverflow.com/questions/5698837/mvc2-consume-rss-feed-with-rdf-and-namespace-http-www-w3-org-1999-02-22-rdf