Microsoft XML 2.5 SDK


 

data Property

[This is preliminary documentation and subject to change.]

Contains this node's data, which depends on the node type.

Syntax

strValue = oXMLDOMCharacterData.data

objXMLDOMCharacterData.data = strValue

Remarks

String. The property is read/write. It contains the same value as the nodeValue for this node. The meaning of the value depends on the XMLDOMNode object's nodeType property, as follows:

NODE_CDATA_SECTION A string representing the text stored in the CDATA section.
NODE_COMMENT The content of the comment, exclusive of the comment begin and end sequence.
NODE_TEXT A string representing the text stored in the text node.

Example

The following VBScript example walks the document tree and checks for comment node types. If one is found, it displays its contents with the  data property:

Dim xmlDoc
Dim comment
Dim root
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set root = xmlDoc.documentElement
  For i = 0 To (root.childNodes.length -1)
    If (root.childNodes.item(i).nodeType = 8) Then
      MsgBox (root.childNodes.item(i).data)
    End If
  Next

Applies To

XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMText