XML DOM substringData() methode
Definitie en gebruik
De methode substringData() van XML DOM Text or Comment Extract a substring from the node.
Syntax:
CharacterData.substringData(start,length)
Parameter | description |
---|---|
start | Required. The position of the first character to be returned. |
length | Required. The number of characters in the substring to be returned. |
Return value
Returns a string containing the substring from start starting length characters.
throw
This method can throw an exception with the following code DOMException exception:
INDEX_SIZE_ERR - parameter start or length is negative, or length greater than the length of the Text node or Comment node.
DOMSTRING_SIZE_ERR - The specified text range is too long and cannot be filled into a string in the JavaScript implementation of the browser.
description
This method extracts from the Text node or Comment node from start starting length characters. This method is useful only when the number of characters in the text contained in the node is greater than the maximum number of characters that can be filled into a string in the JavaScript implementation of the browser. In this case, the JavaScript program cannot directly use the data attribute of the Text node or Comment node, but must use a shorter substring of the node text. In practical applications, this situation is unlikely to occur.
Related pages
XML DOM reference manual:Text.replaceData()
XML DOM reference manual:Comment.replaceData()