Latest web development tutorials
 

XML DOM - The Text Object


The 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 the element or attribute
isElementContentWhitespace Returns true if the text node contains content whitespace, otherwise it returns false
length Returns the length of the text of the element or attribute
wholeText Returns all text of text nodes adjacent to this node, concatenated 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 the text of this node and all adjacent text nodes with the specified text
splitText() Splits this node into two nodes at the specified offset, and returns the new node that contains the text after the offset
substringData() Extracts data from the node