| Returns the data (i.e., nodeValue) contained in the text node. |
Signature: getData() |
Returns:
String - The text data contained in the node.
|
Example:
The text data in the text node will be returned: $myText = $aTextNode->getData(); |
| Returns the number of characters in the text node. |
Signature: getLength() |
Returns:
int - The number of characters in the text node.
|
Example:
The number of characters in the text node will be returned: $totalChars = $aTextNode->getLength(); |
| Returns the specified subset of data from the text node. |
Signature: substringData($offset, $count) |
Parameters:
int offset - The index at which the substring is to begin.
int count - The number of characters from the offset to include.
|
Returns:
String - The requested subset.
|
Example:
The second and third characters in the text node will be returned: $myChars = $aTextNode->substringData(1,2); |
| Appends the specified subset of data to the text node. |
Signature: appendData($arg) |
Parameters:
String arg - The text data to be added to the text node.
|
| Inserts text data at the specified offset. |
Signature: insertData($offset, $arg) |
Parameters:
int offset - The offset at which the text data should be inserted.
String arg - The text data to insert.
|
Example:
The word "Hello, " will be inserted at the beginning to the node text: $aTextNode->insertData(0,"Hello, "); |
| Deletes the specified substring from the text data of the node. |
Signature: deleteData($offset, $count) |
Parameters:
int offset - The index at which the substring is to begin.
int count - The number of characters from the offset to delete.
|
Example:
The second and third characters in the text node will be deleted: $aTextNode->deleteData(1,2); |
| Replaces the specified subset of data with new text. |
Signature: replaceData($offset, $count, $arg) |
Parameters:
int offset - The index at which the substring is to begin.
int count - The number of characters from the offset to replace.
String arg - The replacement text.
|
Example:
The second and third characters in the text node will be replaced by the word "Hello": $aTextNode->replaceData(1,2, "Hello"); |