日期:2014-05-20  浏览次数:20429 次

XmlTextWriter(stream, Encoding)的时候stream始终为空,大家帮忙看看。
System.IO.MemoryStream   stream   =   new   System.IO.MemoryStream();
                        writer   =   new   XmlTextWriter(stream,   Encoding);
                        writer.WriteRaw(xmlStandard);
这时候看stream.Length还是0,xmlStandard内有字符,把writer   =   new   XmlTextWriter(textwriter);以后能正常输出,各位看看我忽略了哪儿了?

------解决方案--------------------
Encoding 是什么编码?
------解决方案--------------------
http://dotnet.aspx.cc/article/04bb9308-b32e-4efd-85c6-1cac83dda93f/read.aspx
------解决方案--------------------
===〉
Stringbuilder sb = new ....
StringWriter sw = new StringWriter( sb );
writer = new XmlTextWriter( sw );
..
Response.Write( sb.ToString() )
至于编码可以通过Web.config 或 Response.AddHeader控制