我正在尝试使用以下代码使用 RSS 提要:
var reader = XmlReader.Create("http://www.news-herald.com/section?template=RSS&profile=4002042&mime=xml");
var syndicationFeed = SyndicationFeed.Load(reader);
但它会抛出一个错误:
“元素”是无效的 XmlNodeType。第 16 行,位置 6。
这表示自封闭“源”标签下方的行:
<source url="http://www.news-herald.com/general-news/20141219/new-richmond-heights-website-expected-to-be-ready-by-april"/>
<description><![CDATA[<p>Richmond Heights is officially replacing the website it has been using since 2006. </p><p>City Council members approved a contract with Cuyahoga County Department of Information Technology at its most recent meeting to design a new website for the city. </p><p>It is projected to cost $5,293 with the contract not to exceed $7,000.</p>]]></description>
如果我手动修改源标签以“”结尾并使用它正确处理的测试文件。
我可以让 SyndicationFeed 或 XmlReader 自动为我执行此操作吗?
我应该使用更好的东西来处理 RSS/atom 提要吗?