responseXML property
Retrieves the response body as an XML Document Object Model (DOM) object.
Syntax
| JavaScript | |
|---|
Property values
Type: Object
The response as an XML document.
Standards information
- XMLHttpRequest, Section 3.7.7
Remarks
Internet Explorer 10 in Windows 8 updates the responseXML property from XMLHttpRequest to return a native XML document by default. This change applies to Internet Explorer 10 Standards and Quirks document modes, making them interoperable with other modern browsers. Compatibility document modes for Windows Internet Explorer 5, 7, 8, and 9 are unchanged. For more info, see XMLHttpRequest responseXML in Internet Explorer 10.
Use QueryInterface to convert the returned pointer p into IXMLDOMDocument.
For properties and methods supported by p, refer to the documentation of IXMLDOMDocument/DOMDocument Members.
responseXML was introduced in Windows Internet Explorer 7.
Using responseXML in Windows Store apps using JavaScript
In Windows Store apps using JavaScript, this property returns a DOMParser object instead of an IXMLDOMDocument object.
Examples
The following example uses the XML DOM to display the response body:
var oReq = new XMLHttpRequest(); oReq.open("GET", "http://localhost/books.xml", false); oReq.send(); console.log(oReq.responseXML.xml);
See also
- XMLHttpRequest
- Reference
- responseBody
- responseText