我的xml-out输出了一些奇怪的行为。
我使用Stringwriter和xmltextwriter填充我的xml。
Using textw As New IO.StringWriter
Using xmlw As New System.Xml.XmlTextWriter(textw)
....
End Using
但是在输出数据时。我得到两个不同的结果('在我眼中')methodoligy。在这两种情况下,tw都将包含我的xml
非工作版本:(在IE中)
Response.Clear()
Response.Write(textw.ToString)
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.ContentType = "text/xml"
Response.End()
错误消息告诉我的xml内容有错误。
工作版:(在IE中)
Response.Clear()
Dim xmlDoc As New XmlDocument
xmlDoc.LoadXml(textw.ToString)
xmlDoc.Save(Response.OutputStream)
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.ContentType = "text/xml"
Response.End()
问题:Response.write
和Response.Outputstream
有什么区别?
注意:两种方法似乎都在firefox&铬。 xml在当前已经在使用(使用工作版本)时有效。