data Property (IXMLDOMCharacterData)


Stores the node data depending on the node type.

strValue =; = strValue;  


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

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");  
var comment;  
var root;  
xmlDoc.async = false;  
xmlDoc.loadXML("<root><!-- Hello --></root>");  
if (xmlDoc.parseError.errorCode != 0) {  
   var myErr = xmlDoc.parseError;  
   WScript.Echo("You have error " + myErr.reason);  
} else {  
   root = xmlDoc.documentElement;  
   for (var i=0; i<root.childNodes.length; i++) {  
      if (root.childNodes.item(i).nodeType == 8) {  
         comment = root.childNodes.item(i);  

strValue = = strValue  

HRESULT get_data(  
    BSTR *strData);  
HRESULT put_data(  
    BSTR strData);  


strData[out, retval][in]
The same value as the nodeValue for this node.

C/C++ Return Values

The value returned if successful.

S_FALSE (for get_dataonly)
The value returned if there is no character data node.

E_INVALIDARG (for get_dataonly)
The value returned if the data parameter is Null.

E_FAIL (for put_dataonly)
The value returned if an error occurs.

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 nodeType property of the IXMLDOMNode, as follows.

NODE_CDATA_SECTIONA string representing the text stored in the CDATA section.
NODE_COMMENTThe content of the comment, exclusive of the comment start and end sequence.
NODE_TEXTA string representing the text stored in the text node.

Implemented in:

MSXML 3.0, MSXML 6.0


nodeType Property1
nodeValue Property