Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM - Text Object

XML DOM - Text Object


Text Object

The Text object represents the textual content of an element or attribute.

Text Object Properties

property Description
data Sets or returns the text of an element or attribute.
isElementContentWhitespace Determines whether a text node contains whitespace character content. Returns true if the text node contains whitespace character content, otherwise returns false.
length Returns the length of the text of an element or attribute.
wholeText Returns all the text of adjacent text nodes to this node, in document order.

Text Object Methods

Method Description
appendData() Appends data to the node.
deleteData() Deletes data from the node.
insertData() Inserts data into the node.
replaceData() Replaces data in the node.
replaceWholeText(text) Replaces this node and all adjacent text nodes with the specified text.
splitText() Splits this node into two nodes at the specified offset, while returning a new node containing the text after the offset.
substringData() Extracts data from the node.