MVC2 - Consume RSS feed with RDF and namespace http://www.w3.org/1999/02/22-rdf-syntax-ns#'

陌路散爱 提交于 2020-01-03 18:34:13

问题


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

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