deleteData Method
Deletes specified data.
Script Syntax
oXMLDOMCharacterData.deleteData(offset, count);
Parameters
- 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.
Example
The following script example creates an IXMLDOMComment
object and uses the deleteData
method to delete the last six characters.
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.deleteData(6, 6); alert(comment.xml); }
Visual Basic Syntax
oXMLDOMCharacterData.deleteData(offset, count)
Parameters
- 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.
Example
The following Microsoft® Visual Basic® example creates an IXMLDOMComment
object and uses the deleteData
method to delete the last six characters.
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.deleteData 6, 6 MsgBox (comment.xml) End If
C/C++ Syntax
HRESULT deleteData( long offset, long count);
Parameters
- offset [in]
- The offset, in characters, at which to start deleting string data.
- count [in]
- The number of characters to delete.
C/C++ Return Values
- S_OK
- The value returned if successful.
- S_FALSE
- The value when returning Null.
- E_FAIL
- The value returned if an error occurs.
Remarks
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.
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.
See Also
length Property (IXMLDOMCharacterData)
Applies to: IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMText