Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Contains the root element of the document.

Script Syntax

Copy Code
var objXMLDOMElement = oXMLDOMDocument.documentElement;
objXMLDOMDocument.documentElement = objXMLDOMElement;

Remarks

Script Parameters

None.

Script Return Value

Object. It returns IXMLDOMElementthat represents the single element that represents the root of the XML document tree. It returns Null if no root exists.

C/C++ Syntax

Copy Code
HRESULT get_documentElement(
  IXMLDOMElement** 
DOMElement
);
HRESULT putref_documentElement(
  IXMLDOMElement* 
DOMElement
);

Remarks

C/C++ Parameters

DOMElement

[out, retval][in] IXMLDOMElementobject that represents the single element representing the root of the XML document tree. Returns Null if no root exists.

C/C++ Return Values

S_OK

Value returned if successful.

S_FALSE (for get_documentElement only)

Value returned if there is no document element.

E_INVALIDARG (for get_documentElement only)

Value returned if DOMElementis Null.

Requirements

Header msxml2.h, msxml2.idl
Windows Embedded CE Windows CE .NET 4.0 and later

General Remarks

When setting the documentElementproperty, the specified element node is inserted into the child list of the document after any document type node. To precisely place the node within the children of the document, call IXMLDOMNode  insertBefore Method.

The parentNode Propertyis reset to the document node as a result of this operation.

The property is read/write, and applies to the following objects and interfaces:

DOMDocument, IXMLDOMElement, and IXMLDOMNode.

See Also

Concepts

parentNode Property

Other Resources