XslCompiledTransform
对象,我希望输出
XmlReader
StreamReader
或者一个
XmlDocument
,但当我尝试
在下面的例子中,
stylesheet
是我的
XslCompiledTransform
对象。前两个
Console.WriteLine
XmlTextReader
正在等待文本,所以我可能需要将其包装在StreamReader中。。?我做错什么了?
MemoryStream transformed = new MemoryStream();
stylesheet.Transform(input, args, transformed);
transformed.Position = 0;
StreamReader s = new StreamReader(transformed);
Console.WriteLine("s = " + s.ReadToEnd()); // writes XML
transformed.Position = 0;
XmlDocument doc = new XmlDocument();
doc.Load(transformed);
Console.WriteLine("doc = " + doc.OuterXml); // writes XML
transformed.Position = 0;
XmlReader reader = new XmlTextReader(transformed);
Console.WriteLine("reader = " + reader.ReadOuterXml()); // no XML written