Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
gnu.xml.dom.DomNode
gnu.xml.dom.DomCharacterData
gnu.xml.dom.DomText
Constructor Summary | |
| |
|
Method Summary | |
String |
|
String |
|
boolean |
|
Text |
|
Text |
|
Methods inherited from class gnu.xml.dom.DomCharacterData | |
appendData , deleteData , getBaseURI , getChildNodes , getData , getLength , getNodeValue , insertData , replaceData , setData , setNodeValue , substringData |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected DomText(DomDocument owner, String value)
Constructs a text node associated with the specified document and holding the specified data. This constructor should only be invoked by a Document object as part of its createTextNode functionality, or through a subclass which is similarly used in a "Sub-DOM" style layer.
public String getNodeName()
DOM L1 Returns the string "#text".
- Specified by:
- getNodeName in interface Node
- Overrides:
- getNodeName in interface DomNode
public String getWholeText()
Returns all text ofText
nodes logically-adjacent text nodes to this node, concatenated in document order.
For instance, in the example belowwholeText
on theText
node that contains "bar" returns "barfoo", while on theText
node that contains "foo" it returns "barfoo".
- Specified by:
- getWholeText in interface Text
- Since:
- DOM Level 3
public boolean isElementContentWhitespace()
Returns whether this text node contains element content whitespace, often abusively called "ignorable whitespace". The text node is determined to contain whitespace in element content during the load of the document or if validation occurs while usingDocument.normalizeDocument()
.
- Specified by:
- isElementContentWhitespace in interface Text
- Since:
- DOM Level 3
public Text replaceWholeText(String content) throws DOMException
Replaces the text of the current node and all logically-adjacent text nodes with the specified text. All logically-adjacent text nodes are removed including the current node unless it was the recipient of the replacement text.
This method returns the node which received the replacement text. The returned node is:
null
, when the replacement text is the empty string;- the current node, except when the current node is read-only;
- a new
Text
node of the same type (Text
orCDATASection
) as the current node inserted at the location of the replacement.
For instance, in the above example callingreplaceWholeText
on theText
node that contains "bar" with "yo" in argument results in the following:
Where the nodes to be removed are read-only descendants of anEntityReference
, theEntityReference
must be removed instead of the read-only nodes. If anyEntityReference
to be removed has descendants that are notEntityReference
,Text
, orCDATASection
nodes, thereplaceWholeText
method must fail before performing any modification of the document, raising aDOMException
with the codeNO_MODIFICATION_ALLOWED_ERR
.
For instance, in the example below callingreplaceWholeText
on theText
node that contains "bar" fails, because theEntityReference
node "ent" contains anElement
node which cannot be removed.
- Specified by:
- replaceWholeText in interface Text
- Parameters:
content
- The content of the replacingText
node.
- Returns:
- The
Text
node created with the specified content.
- Throws:
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if one of theText
nodes being replaced is readonly.
- Since:
- DOM Level 3