| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectgnu.xml.dom.DomNodegnu.xml.dom.DomCharacterDatagnu.xml.dom.DomTextConstructor 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 ofTextnodes logically-adjacent text nodes to this node, concatenated in document order.
For instance, in the example belowwholeTexton theTextnode that contains "bar" returns "barfoo", while on theTextnode 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
Textnode of the same type (TextorCDATASection) as the current node inserted at the location of the replacement.
For instance, in the above example callingreplaceWholeTexton theTextnode that contains "bar" with "yo" in argument results in the following:
Where the nodes to be removed are read-only descendants of anEntityReference, theEntityReferencemust be removed instead of the read-only nodes. If anyEntityReferenceto be removed has descendants that are notEntityReference,Text, orCDATASectionnodes, thereplaceWholeTextmethod must fail before performing any modification of the document, raising aDOMExceptionwith the codeNO_MODIFICATION_ALLOWED_ERR.
For instance, in the example below callingreplaceWholeTexton theTextnode that contains "bar" fails, because theEntityReferencenode "ent" contains anElementnode which cannot be removed.
- Specified by:
- replaceWholeText in interface Text
- Parameters:
content- The content of the replacingTextnode.
- Returns:
- The
Textnode created with the specified content.
- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if one of theTextnodes being replaced is readonly.
- Since:
- DOM Level 3