Inserts a string at the specified offset.
oXMLDOMCharacterData.insertData(offset, data);
The following script example creates an IXMLDOMComment object and uses the insertData method to insert a string into it.
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.insertData(6, "Beautiful ");
alert(comment.xml);
}
oXMLDOMCharacterData.insertData(offset, data)
The following Microsoft® Visual Basic® example creates an IXMLDOMComment object and uses the insertData method to insert a string into it.
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.insertData 6, "Beautiful "
MsgBox (comment.xml)
End If
HRESULT insertData(
long offset,
BSTR data);
The length property is updated by this operation.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button
in the upper-left corner of the page.
Applies to: IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMText