Hi folks.
The XMLHttpRequest spec says that, if an HTTP response contains a
content-type header that is not XML, XMLHttpRequest .responseXML
should return NULL (http://www.w3.org/TR/XMLHttpRequest/#xml-response-entity-body
).
I'm looking into this issue because it has broken a widget on Mac OS
X. The widget uses XMLHttpRequest to load a valid XML file and then
read responseXML. Unfortunately, the file comes to use with an
incorrect MIME type (application/octet-stream), so we return NULL and
later throw an exception.
To me, it seems preferable to try to parse the response as XML,
returning NULL only if parsing fails. The spec already says you should
do this if the content-type header is missing. Why not do it always?
Thanks,
Geoff
- XMLHttpRequest.responseXML returning null for non-XML ... Geoffrey Garen
-