Microsoft XML SDK 2.6 - XML Reference

replaceData Method

Replaces the specified number of characters with the supplied string.

oXMLDOMCharacterData.replaceData(offset, count, data)

Parameters

offset
Long integer value specifying the offset, in characters, at which to start replacing string data.
count
Long integer value specifying the number of characters to replace.
data
String containing the new data that replaces the old string data.

Example

The following VBScript example creates a new XMLDOMComment object, and then replaces the first five characters with a new string:

Dim xmlDoc
Dim comment
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set comment = xmlDoc.createComment("Hello World!")
MsgBox comment.xml
comment.replaceData 0,5,"Goodbye, Cruel"
MsgBox comment.xml

See Also

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