public abstract class AbstractTextual extends AbstractItem implements Textual, org.w3c.dom.CharacterData
Note: any deriving class's getText shall not return null.
Element.getText uses this class's isPartOfParentText to know whether a child's text shall be concatenated.
Element,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
_text
The text.
|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODEFIND_BY_PREFIX, FIND_BY_REGEX, FIND_BY_TAGNAME, FIND_IGNORE_CASE, FIND_RECURSIVE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTextual()
Constructor.
|
protected |
AbstractTextual(java.lang.String text)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendData(java.lang.String newData) |
protected void |
checkText(java.lang.String text)
Checks whether the text is valid.
|
void |
deleteData(int offset,
int count) |
java.lang.String |
getData() |
int |
getLength() |
java.lang.String |
getText()
|
java.lang.String |
getTextContent() |
java.lang.String |
getWholeText() |
void |
insertData(int offset,
java.lang.String arg) |
boolean |
isCoalesceable()
Returns true if this textual object is allowed to be coalesced with
its siblings with the same type (class).
|
boolean |
isElementContentWhitespace() |
boolean |
isPartOfParentText()
Returns true if this text object is part of the parent's text.
|
void |
replaceData(int offset,
int count,
java.lang.String arg) |
org.w3c.dom.Text |
replaceWholeText(java.lang.String content) |
void |
setData(java.lang.String data) |
void |
setText(java.lang.String text)
Sets the text of this item.
|
Textual |
split(int offset)
Splits at the specified offset into two Textual objects.
|
org.w3c.dom.Text |
splitText(int offset) |
java.lang.String |
substringData(int offset,
int count) |
java.lang.String |
toString()
Gets the textual representation for debug.
|
appendChild, clone, cloneNode, compareDocumentPosition, detach, equals, getAttributes, getBaseURI, getChildNodes, getDocument, getFeature, getFirstChild, getLastChild, getLocalName, getLocator, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParent, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, hashCode, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, match, normalize, removeChild, replaceChild, setLocator, setName, setNodeValue, setParent, setPrefix, setTextContent, setUserDatafinalize, getClass, notify, notifyAll, wait, wait, waitappendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserDataprotected AbstractTextual(java.lang.String text)
protected AbstractTextual()
public boolean isPartOfParentText()
isPartOfParentText in interface Textualpublic boolean isCoalesceable()
Default: false. Right now only Text override it to true.
isCoalesceable in interface Textualpublic Textual split(int offset)
Textualprotected void checkText(java.lang.String text)
public java.lang.String getText()
ItemTextual
nor Element.
For Element, the text is the concatenation of all its textual
children, including Text, CDATA, and Binary.
Besides String-type value, some item, e.g., Binary, allows any type of objects. Caller could test whether a item implements the Binable interface, and use Binable.getValue instead. For binable vertices, getText is actually getValue().toString().
The returned value is neither trimmed nor normalized.
getText in interface ItemgetText in class AbstractItempublic void setText(java.lang.String text)
ItemsetText in interface ItemsetText in class AbstractItempublic final int getLength()
getLength in interface org.w3c.dom.CharacterDatapublic final java.lang.String getData()
getData in interface org.w3c.dom.CharacterDatapublic final void setData(java.lang.String data)
setData in interface org.w3c.dom.CharacterDatapublic final java.lang.String substringData(int offset,
int count)
substringData in interface org.w3c.dom.CharacterDatapublic final void appendData(java.lang.String newData)
appendData in interface org.w3c.dom.CharacterDatapublic final void insertData(int offset,
java.lang.String arg)
insertData in interface org.w3c.dom.CharacterDatapublic final void deleteData(int offset,
int count)
deleteData in interface org.w3c.dom.CharacterDatapublic final void replaceData(int offset,
int count,
java.lang.String arg)
replaceData in interface org.w3c.dom.CharacterDatapublic final org.w3c.dom.Text splitText(int offset)
public boolean isElementContentWhitespace()
public java.lang.String getWholeText()
public org.w3c.dom.Text replaceWholeText(java.lang.String content)
throws DOMException
DOMExceptionpublic java.lang.String getTextContent()
getTextContent in interface org.w3c.dom.NodegetTextContent in class AbstractItempublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2005-2011 Potix Corporation. All Rights Reserved.