deleteData Method

 

Deletes specified data.

oXMLDOMCharacterData.deleteData(offset, count);

 offset

A long integer value specifying the offset, in characters, at which to start deleting string data.

 count

A long integer value specifying the number of characters to delete.

The following script example creates an IXMLDOMComment object and uses the deleteData method to delete three characters of data starting after the third character in data for the IXMLDOMComment object.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
var comment;
xmlDoc.async = false;
xmlDoc.loadXML("<root><child/></root>");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   comment = xmlDoc.createComment("123456789");
   WScript.Echo("Before deleting data: " + comment.xml);
   comment.deleteData(3, 3);
   WScript.Echo("After deleting data: " + comment.xml);}

Before deleting data: <!--123456789>

After deleting data: <!--123789>

HRESULT deleteData(
    long offset,
    long count);

 offset[in]

The offset, in characters, at which to start deleting string data.

 count[in]

The number of characters to delete.

S_OK

The value returned if successful.

S_FALSE

The value when returning Null.

E_FAIL

The value returned if an error occurs.

If the offset and count of characters specify a range beyond the end of the string, this method deletes only to the end of the string.

The length property is updated by this operation.

Implemented in: MSXML 3.0 and MSXML 6.0

Show: