If the server side in an Ajax application uses ASPX to return XML format data, the HTML characters generated by VS are generally cleared first, and Response.Write is used directly in the code file to output the XML string.
It should be noted that the client must set the corresponding properties of Response to correctly parse the string.
First set the ContentType property:
Response.ContentType = "text/xml";
If the xml string contains Chinese, the Charset attribute must also be set:
Response.Charset = "GB2312";
Then output the content in the format of an XML file:
Response.Write("<?xml version="1.0" encoding="GB2312" ?>");
Today, I was depressed for a long time because of this Charset. Because the XML characters contain Chinese characters and Charset is not set, XMLHttpRequest.responseXML is always null. After checking the information for a long time, I finally realized it.
http://smartstone.cnblogs.com/archive/2006/07/08/446181.html