XMLDocument property

Retrieves a reference to the XML Document Object Model (DOM) exposed by the object.

Syntax

JavaScript

oXMLObject = object.XMLDocument

Property values

Type: Object

An Object that specifies a reference to the XML DOM exposed by the object.

Remarks

XMLDocument is the default property; specifying the property is optional. The XMLDocument property is useful when an entire XML document is passed to a method that requires an IXMLDOMNode parameter, such as the transformNode method. The XML data island itself (denoted by the <xml> tag) is considered an html element, instead of an xml element. The XMLDocument property provides access to the root of the XML tree in the data island.

For a complete description of the XML DOM exposed by the XMLDocument property, see the XML DOM overview.

Examples

This example uses the XMLDocument property to access the object model of an xml data island.


<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=8" > <!-- XML islands are not supported in Internet Explorer 9 and later. -->
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <title>XML Islands</title>
</head>

<body>
  <xml id="metaData">
    <metadata>
       <author>John Smith</author>
       <generator>Visual Notepad</generator>
       <pagetype>Reference</pagetype>
       <abstract>Specifies an XML data island.</abstract>
    </metadata>
  </xml>
  <button onclick="fnCheck();">Parse XML</button>
  <script>
    function fnCheck(){
      var metaData = document.getElementById('metaData');
      
      if (!metaData.XMLDocument) {
          alert ("Your browser doesn't support the XMLDocument property.");
      }
      
      var abstractNode = metaData.XMLDocument.selectSingleNode("metadata/abstract");
      alert(abstractNode.text);
    } // fnCheck
  </script>
</body>

</html>

See also

xml
Reference
XSLDocument
Conceptual
Introduction to Persistence

 

 

Show:
© 2014 Microsoft. All rights reserved.