【发布时间】:2014-02-18 14:26:34
【问题描述】:
我正在尝试将 rss(xml 格式)作为数据源加载,但是当我尝试将其加载到 Syndication 提要时,它会引发错误:
未找到命名空间名称为“”的元素“通道”。第 1 行,位置 21。
这是我的代码:
public IEnumerable<FeedItem> GetRssFeedList()
{
XmlReader reader = XmlReader.Create(_urlRssFeed);
SyndicationFeed feed = SyndicationFeed.Load(reader);
var feedItems = feed.Items.Select(c=> new FeedItem { Title = c.Title.Text, Link = c.Links.FirstOrDefault().ToString(), Description = c.Summary.Text});
return feedItems;
}
_urlRssFeed = "http://www.educaweb.com/rss/actualidad/"
我检查了它是否是一个有效的 RSS 并且它是: http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.educaweb.com%2Frss%2Factualidad%2F
我不知道它可能是什么?提前致谢。
顺便说一下,这是我的自定义提要项目类:
public class FeedItem
{
public string Title { get; set; }
public string Link { get; set; }
public string Description { get; set; }
}
希望能帮到我! 谢谢!
【问题讨论】:
-
会不会是 w3.org/1999/xhtml" /> ?不知道为什么会这样!
-
我该怎么做才能将其删除并使其正常工作?我无法修改 rss...
标签: c# xml rss syndication