XMLHttpRequest responseXML error
I use XMLHttpRequest for xsl file loading (Internet Explorer 7):
var url = "template.xsl";
var request = new XMLHttpRequest();
var async = false;
request.open("GET", url, async);
request.send();
But "request.responseXML" is invalid. Here error information from "request.responseXML.parseError":
- errorCode: -1072896681 - reason: "Invalid xml declaration." - srcText: ""Here is the "request.responseT开发者_C百科ext":
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- content -->
</xsl:stylesheet>
How I can fix this error?
It should work.. I think respnseText should be empty. did you check request.getAllResponseHeaders() (or .getResponseHeader('Content-Type')) ? The content-type should be text/xml
Also you might be interested in this question
精彩评论