MVC2 - 使用 RDF 和命名空间使用 RSS feed http://www.w3.org/1999/02/22-rdf-syntax-ns#'
我试图阅读华盛顿鱼类和野生动物部门的提要,并不断出现此错误:
名称为“RDF”的元素和 名称空间 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' 不是允许的 Feed 格式。
这是来自 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);
}
}
我已经完成了几个 RSS 应用程序,但从未遇到过这个问题。有人知道能够在 ASP.NET MVC 2 中解析此内容的具体方法吗? (带有星号的行是发生异常的地方。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不支持 RSS 1.0。如何在此处提供您自己的支持的示例:https://web.archive.org/web/20211020140320/https://www.4guysfromrolla.com/articles/031809-1.aspx
There's no support for RSS 1.0. Example of how to roll your own support here : https://web.archive.org/web/20211020140320/https://www.4guysfromrolla.com/articles/031809-1.aspx
这可能不适用于您,因为听起来您只对 RSS 感兴趣,但如果您希望您的应用程序支持 RDF(RSS 1.0 使用 RDF/XML 对其数据进行编码),那么您可以尝试我的库 dotNetRDF。
从你的问题来看,我怀疑完整的 RDF API 可能有点过大了。
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.