简体   繁体   English

MVC2 - 使用RDF和命名空间使用RSS提要http://www.w3.org/1999/02/22-rdf-syntax-ns#'

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

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. 名称为“RDF”且命名空间为“http://www.w3.org/1999/02/22-rdf-syntax-ns#”的元素不是允许的Feed格式。

Here's the code from RssController: 这是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. 我已经完成了seveal RSS应用程序,但是nave从未遇到过这个问题。 Anyone got any concrete ways of being able to parse this in ASP.NET MVC 2? 任何人都有任何具体的方法可以在ASP.NET MVC 2中解析它? (the lines with asterics are where the exception happens. (带有星号的行是异常发生的地方。

There's no support for RSS 1.0. RSS 1.0不支持。 Example of how to roll your own support here : http://www.4guysfromrolla.com/articles/031809-1.aspx 如何在此处推广自己的支持的示例: http//www.4guysfromrolla.com/articles/031809-1.aspx

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 . 这可能不适用于您,因为它听起来您只对RSS感兴趣,但如果您希望RDF支持您的应用程序(RSS 1.0使用RDF / XML来编码它的数据),那么您可以尝试我的库dotNetRDF

I suspect that a full blown RDF API is probably overkill though judging from your question. 我怀疑从你的问题判断,一个完整的RDF API可能有点过分。

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

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