Share via


IXMLDOMNode.nodeValue (Visual Basic .NET)

banner art

Previous Next

IXMLDOMNode.nodeValue (Visual Basic .NET)

The nodeValue property contains the text associated with the node.

Syntax

  Variant = IXMLDOMNode.nodeValue
IXMLDOMNode.nodeValue = Variant

Remarks

The property is read/write.

Setting or returning the value of the object depends on the type of node on which the nodeValue property is called, as shown in the following table. For example, if the node type is NODE_ATTRIBUTE, either an object is returned containing a string representing the value for that attribute node or an object containing a string sets the value for the attribute node.

Node type Value returned or set
NODE_ATTRIBUTE Contains a string representing the value of the attribute. For attributes with subnodes, this is the concatenated text of all subnodes with entities expanded. Setting this value deletes all children of the node and replaces them with a single text node containing the value written.
NODE_COMMENT Contains the content of the comment, exclusive of the comment's start and end sequence.
NODE_ELEMENT, NODE_DOCUMENT Returns NULL. Attempting to set the value of nodes of these types generates an error.
NODE_PROCESSING_INSTRUCTION Contains the processing instruction, excluding the target. (The target appears in the nodeName property.)
NODE_TEXT Contains a string representing the text stored in the text node.

Example Code

The following example creates an IXMLDOMNode object and tests whether it is a comment node. If it is, its value is displayed.

Imports interop_msxml
Imports Microsoft.WindowsMediaServices.Interop

On Error GoTo Err

' Declare variables.
Dim Server As New WMSServerClass()
Dim Playlist As IXMLDOMDocument
Dim currNode As IXMLDOMNode

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

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

' Retrieve the first child node of the root element and 
' display its node value if the node type is NODE_COMMENT.
Set currNode = Playlist.documentElement.childNodes.Item(0)
If currNode.nodeTypeString = "comment" Then
  MsgBox currNode.nodeValue
End If
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