Share via


IXMLDOMNode.childNodes (Visual Basic .NET)

banner art

Previous Next

IXMLDOMNode.childNodes (Visual Basic .NET)

The childNodes property contains a list of the child nodes.

Syntax

  IXMLDOMNodeList = IXMLDOMNode.childNodes

Remarks

The property is read-only. An IXMLDOMNodeList object is returned even if there are no children of the node. In such a case, the length of the list will be set to zero. For information about valid child node types for each node, see XML DOM Enumerated Constants.

The value of the IXMLDOMNodeList object that is returned depends on the type of node on which the childNodes property is called, as shown in the following table. For example, if the node type is NODE_ELEMENT, an IXMLDOMNodeList object is returned containing a list of child nodes for that element node.

Node type Value returned
NODE_ATTRIBUTE
NODE_DOCUMENT
NODE_ELEMENT
Returns an IXMLDOMNodeList object that contains a list of all child nodes for the specified node.
NODE_COMMENT
NODE_PROCESSING_INSTRUCTION
NODE_TEXT
Returns an IXMLDOMNodeList object with a length of zero. This node type cannot have children.

Example Code

The following example uses the childNodes property (collection) to return an IXMLDOMNodeList object, and then iterates through the collection, displaying the name of each item.

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
Dim oNodeList As IXMLDOMNodeList
Dim Item As IXMLDOMNode

' 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

Set oNodeList = root.childNodes
For Each Item In oNodeList
  MsgBox Item.nodeName
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