ローカルに保存されているXMLデータからSyndicationFeedオブジェクト(System.ServiceModel.Syndication)を再作成しようとしています。
XMLDocumentを使用している場合、これは簡単です。LoadXml(string)を呼び出します。
SyndicationFeedはXMLReaderからのみロードされます。XMLReaderは、Streamまたは別のXMLReaderまたはTextReaderのみを受け取ります。
XMLDocumentは文字列をロードするので、次のように(拡張メソッドの形式で)これを実行しようとしました。
public static SyndicationFeed ToSyndicationFeed(this XmlDocument document)
{
Stream thestream = Stream.Null;
XmlWriter thewriter = XmlWriter.Create(thestream);
document.WriteTo(thewriter);
thewriter.Flush();
XmlReader thereader = XmlReader.Create(thestream);
SyndicationFeed thefeed = SyndicationFeed.Load(thereader);
return thefeed;
}
これを機能させることができません。XMLDocumentにSyndicationFeedにロードされるフィードが入力されている場合でも、ストリームは常に空です。
あなたが与えることができるどんな助けやポインタも最も役に立ちます。
ありがとう、ロベルト