appendData Method

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

appendData Method

Appends the supplied string to the existing string data.

[Script]

Script 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.5.0");
var comment;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode <> 0) {
   var myErr = xmlDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
   comment = xmlDoc.createComment("Hello World!");
   comment.appendData("Ellohay Orldway!");
   alert(comment.data);
}
[Visual Basic]

Visual Basic Syntax

oXMLDOMCharacterData.appendData(data)

Parameters

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

Example

The following Microsoft® Visual Basic® example creates an IXMLDOMComment object and uses the appendData method to add text to the string.

Dim xmlDoc As New Msxml2.DOMDocument50
Dim comment As IXMLDOMComment
xmlDoc.async = False
xmlDoc.Load ("books.xml")
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox("You have error " & myErr.reason)
Else
   Set comment = xmlDoc.createComment("Hello World!")
   comment.appendData ("Ellohay Orldway!")
   MsgBox (comment.Data)
End If
[C/C++]

C/C++ Syntax

HRESULT appendData(
    BSTR data);

Parameters

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

C/C++ 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.

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

length Property (IXMLDOMCharacterData)

Applies to: IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMText