IXMLDOMDocument.documentElement (Visual Basic .NET)

banner art

Previous Next

IXMLDOMDocument.documentElement (Visual Basic .NET)

The documentElement property contains the root element of the document.

Syntax

  IXMLDOMElement = IXMLDOMDocument
  .documentElement

  IXMLDOMDocument
  .documentElement
   = IXMLDOMElement

Remarks

The property is read/write. It returns the IXMLDOMElement object 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 IXMLDOMNode.insertBefore method.

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

Example Code

The following example creates an IXMLDOMElement object and sets it to the root element of the document by using the documentElement property. It then traverses the document tree.

Imports interop_msxml
Imports Microsoft.WindowsMediaServices.Interop

On Error GoTo Err

' Declare variables.
Dim Server As New WMSServerClass()
Dim Playlist As IXMLDOMDocument
Dim root As IXMLDOMElement

' Create a new playlist object.
Set Playlist = Server.CreatePlaylist

' Load a playlist.
Playlist.Load ("file://c:\wmpub\wmroot\simple.wsx")

' Retrieve the root element.
Set root = Playlist.documentElement

' Display the node value from every attribute in the 
' child nodes.
For i = 0 To (root.childNodes.length - 1)
  MsgBox root.childNodes.Item(i).Attributes.Item(0).nodeValue
Next
Exit Sub

Err:
' TODO: Handle errors.

Requirements

Reference: Add references to Microsoft.WindowsMediaServices and interop_msxml.

Namespace: Microsoft.WindowsMediaServices.Interop, interop_msxml.

Assembly: Microsoft.WindowsMediaServices.dll, interop_msxml.dll.

Library: WMSServerTypeLib.dll, msxml.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next