Xmldoc_Object DocumentElement Method

Returns the DOM document tree top-level element as an XmlNode object.

…xmldoc_object.DocumentElement

Prerequisites

None

Parameters

None

Remarks

All DOM documents, whether created by the XmlDoc constructor (New), XmlDoc.LoadFile, or XmlDoc.LoadString, have a single top-level (or root) element whose descendents contain the rest of the document tree.

This method returns that top-level element as an XmlNode object.

Examples

Dim doc As XmlDoc
Dim root As XmlNode
doc = New XmlDoc("my_doc")
root = doc.DocumentElement
Console.Writeline(root.Name) ' Displays "my_doc"

See Also

XML Classes | XmlDoc New | XmlDoc.LoadFile | XmlDoc.LoadString