Skip to main content
responseXML property

Retrieves the response body as an XML Document Object Model (DOM) object.

Syntax

JavaScript

xmlDocument = object.responseXML

Property values

Type: Object

The response as an XML document.

Standards information

Remarks

A Windows Store app using JavaScript in Windows 8 updates the responseXML property from XMLHttpRequest to return a native XML document by default. This change applies to a Windows Store app using JavaScript Standards and Quirks document modes, making them interoperable with other modern browsers. Compatibility document modes for a Windows Store app using JavaScript 5, 7, 8, and 9 are unchanged. For more info, see XMLHttpRequest responseXML in Internet Explorer 10.

For properties and methods supported by p, refer to the documentation of IXMLDOMDocument/DOMDocument Members.

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