nedcomp hosting homepage

Producten en Diensten
Dedicated servers
Datacenter informatie
Partners, resellers
Helpdesk informatie
Technische docs, tools
Support homepage
ASP componenten
Praktische ASP, ASP.NET
Visual route server
Whois (domein gegevens)
Software documentatie
Whitepapers
Zoeken
Nedcomp / algemeen

Zoeken
 

Copyright © Nedcomp Hosting
Telefoon nr :   +31 184 670111
Fax nummer :   +31 184 631384
E-mailadres :   info@nedcomp.nl
 

Microsoft XML Core Services (MSXML) 4.0 - DOM Reference

documentElement Property

Contains the root element of the document.

[Script]

Script Syntax

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

Example

The following script example creates an IXMLDOMElement object and sets it to the root element of the document with the documentElement property. It then walks the document tree.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
var root;
xmlDoc.async = false;
xmlDoc.load("books.xml");
root = xmlDoc.documentElement;
for (var i=0; i<root.childNodes.length; i++) {
  alert(root.childNodes.item(i).childNodes.item(0).text);
}
[Visual Basic]

Visual Basic Syntax

Set objXMLDOMElement = oXMLDOMDocument.documentElement
Set objXMLDOMDocument.documentElement = objXMLDOMElement 

Example

The following Microsoft® Visual Basic® example creates an IXMLDOMElement object and sets it to the root element of the document with the documentElement property. It then walks the document tree.

Dim xmlDoc As New Msxml2.DOMDocument40
Dim root As IXMLDOMElement
xmlDoc.async = False
xmlDoc.Load ("books.xml")
Set root = xmlDoc.documentElement
For i = 0 To (root.childNodes.length - 1)
  MsgBox root.childNodes.Item(i).childNodes.Item(0).Text
Next
[C/C++]

C/C++ Syntax

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

Parameters

DOMElement [out, retval][in]
The IXMLDOMElement object 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
The value returned if successful.
S_FALSE (for get_documentElement only)
The value returned if there is no document element.
E_INVALIDARG (for get_documentElement only)
The value returned if DOMElement is Null.

Remarks

The property is read/write. It returns an IXMLDOMElement that represents the single element that represents the root of the XML document tree. It returns Null if no root exists.

When setting the documentElement property, 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 the insertBefore method of the IXMLDOMNode.

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

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

insertBefore Method | IXMLDOMElement | IXMLDOMNode | parentNode Property

Applies to: DOMDocument


Download de SDK