Reputation: 1699
It is possible to configure XHR
to receive an HTML document with
xhr.responseType = "document";
When the response is received, xhr.responseXML
holds an HTML document, parsed against HTML namespace URI. You can check:
xhr.responseXML.children[0].namespaceURI === 'http://www.w3.org/1999/xhtml'
How can I get a pure XML document response, not parsed as HTML, something like:
document.implementation.createDocument(null,'');
Upvotes: 1
Views: 356
Reputation: 1699
Didn't find documentation about this issue, but it seems (FF & Chromium at least) that the js engine parses the xhr.responseXML
depending on the resource's file extension:
it casts to HTML .html
files and to generic XML .xml
files
Upvotes: 1