Microsoft XML SDK 2.6 - XML Reference

data Property (XMLDOMCharacterData)

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

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 start 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("Msxml2.DOMDocument")
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

See Also

Applies To: XMLDOMCDATASection Object | XMLDOMCharacterData Object | XMLDOMComment Object | XMLDOMText Object