Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SyndicationFeed.Load投掷';元素';是无效的XmlNodeType。_C#_.net_Rss_Atom Feed_Syndicationfeed - Fatal编程技术网

C# SyndicationFeed.Load投掷';元素';是无效的XmlNodeType。

C# SyndicationFeed.Load投掷';元素';是无效的XmlNodeType。,c#,.net,rss,atom-feed,syndicationfeed,C#,.net,Rss,Atom Feed,Syndicationfeed,我试图使用以下代码使用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 表示自关闭“源”标签下方的行: 里士满高地(R

我试图使用以下代码使用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

表示自关闭“源”标签下方的行:


里士满高地(Richmond Heights)正式取代了自2006年以来一直使用的网站

市议会成员在最近一次会议上批准了与Cuyahoga县信息技术部的合同,为该市设计一个新网站

预计成本为5293美元,合同金额不超过7000美元。

]>
如果我手动修改源标记以“”结尾,并使用该测试文件,它将正确处理

我可以让SyndicationFeed或XmlReader为我自动执行此操作吗


我是否应该使用更好的方法来处理RSS/atom提要?

源代码似乎没有问题

测试另一个rss源以验证它

The feed appears to be encoded as "UTF-8", but the server is reporting "iso-8859-1"
您可以尝试将源代码读入XDocument,将编码更改为您想要的,然后尝试加载它

The feed appears to be encoded as "UTF-8", but the server is reporting "iso-8859-1"