Поделиться через


appendData Method

 

Appends the supplied string to the existing string data.

JScript Syntax

oXMLDOMCharacterData.appendData(data);  

Parameters

data
A string containing the data that is to be appended to the existing string.

Example

The following script example creates an IXMLDOMComment object and uses the appendData method to add text to the string.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");  
var comment;  
xmlDoc.async = false;  
xmlDoc.loadXML("<root></root>");  
if (xmlDoc.parseError.errorCode != 0) {  
   var myErr = xmlDoc.parseError;  
   WScript.Echo("You have error " + myErr.reason);  
} else {  
   comment = xmlDoc.createComment("Hello...");  
   comment.appendData(" ... World!");  
   WScript.Echo(comment.data);  
}  

Output

Hello... ... World!  

C/C++ Syntax

HRESULT appendData(  
    BSTR data);  

Parameters

data[in]
The string data to be appended to the existing string.

Return Values

S_OK
The value returned if successful.

S_FALSE
The value returned if the string is not appended.

E_FAIL
The value returned if an error occurs.

Remarks

The length property is also updated by this operation.

Versioning

Implemented in: MSXML 3.0 and MSXML 6.0

Applies to

IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMText

See Also

length Property (IXMLDOMCharacterData)