我正在尝试生成 XML,但遇到了这个异常:
XmlTextWriter xmlWriter = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("userInfo");
它给了我一个例外:
WriteStartDocument needs to be the first call.
但正如您所见,我确实先调用了 WriteStartDocument()!
有任何想法吗?