System.ServiceModel.Syndication
ライブラリを使用して RSS フィードを解析するコードを作成しました。
問題は、フィードの 1 つ (facebook によって提供される) について、応答の最後に次の行が表示され、シンジケーション ライブラリがフィードの解析に失敗することです。部:
...
</channel>
<access:restriction relationship="deny" xmlns:access="http://www.bloglines.com/about/specs/fac-1.0" />
</rss>
フィードと解析ライブラリの両方が巨大企業 (それぞれ Facebook と Microsoft) から提供されているため、ここで何かが欠けていると確信しています。
どなたかお助けいただけませんか?それとも、XML の有効性に依存しない、より優れたパーサーですか?
PS これが私の RSS フィードの URL です:
http://www.facebook.com/feeds/page.php?id=202296766494181&format=rss20
フィード応答を解析する方法は次のとおりです。
var stringReader = new StringReader(resp);
var xreader = XmlReader.Create(stringReader);
var xfeed = System.ServiceModel.Syndication.SyndicationFeed.Load(xreader);
そして私が得る例外:
System.Xml.XmlException: 'Element' is an invalid XmlNodeType. Line 282, position 4.
System.Xml.XmlReader.ReadEndElement() で ...