2
로컬에 저장된 XML 데이터에서 SyndicationFeed 개체 (System.ServiceModel.Syndication)를 다시 만들려고합니다.문자열에서 SyndicationFeed를 만드는 방법이 있습니까?
XMLDocument로 작업하고 있다면 쉽게 할 수 있습니다. LoadXml (string)을 호출 할 것입니다.
SyndicationFeed는 XMLReader에서만로드됩니다. XMLReader는 Stream 또는 다른 XMLReader 또는 TextReader 만 사용합니다.
XMLDocument로 문자열을로드하기 때문에
는, 나는의 (a 확장 메서드의 형태로) 다음과 같이이 작업을 수행하려고했습니다 :이 동작하지 않습니다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에로드 될 피드로 채워지더라도 스트림은 항상 비어 있습니다.
도움이나 조언이 도움이 될 것입니다.
덕분에, 로베르토
* 머리 데스크 * 나는 StringReader를 잊었다. 내가 그것을 시도하자. –
그것은 효과가 있었다. 고마워요. –
문제 없으니 도움이 되니 기쁩니다. – Lee