public interface OMText extends OMNode
OMNode.getType()
method may be used to distinguish between these
different types of character data.
By default, Axiom uses StAX parsers configured in coalescing mode. As a
consequence, CDATA sections will not result in nodes of type
OMNode.CDATA_SECTION_NODE
nodes, but of type OMNode.TEXT_NODE
(See the Javadoc of StAXUtils
for
information about how to change this behavior). In addition, the object model
instance will never contain two adjacent OMText
siblings.
The same is not necessarily true for Axiom trees that have been built or
updated programmatically or that contain nodes resulting from the expansion
of an OMSourcedElement
. Therefore, code that manipulates character
data MUST NOT assume that text nodes are always coalesced. In particular,
when extracting character data from an element, OMElement.getText()
should be used instead of getText()
.
An OMText
node stores the character data as String
,
char[]
or a DataHandler
. The latter is
used for base64 encoded binary data.
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE
Modifier and Type | Method and Description |
---|---|
String |
getContentID()
Gets the content id.
|
Object |
getDataHandler()
Gets the datahandler.
|
OMNamespace |
getNamespace()
Deprecated.
This API is going away. Please use
OMElement.getTextAsQName() instead. |
String |
getText()
Returns the text value of this node.
|
QName |
getTextAsQName()
Deprecated.
If the underlying parser is non coalescing, then this method may unexpectedly
fail or return an incorrect result. Always use
OMElement.getTextAsQName()
to get the QName value of an element. |
char[] |
getTextCharacters()
Deprecated.
|
boolean |
isBinary() |
boolean |
isCharacters()
Deprecated.
|
boolean |
isOptimized() |
void |
setBinary(boolean value)
Sets the isBinary flag.
|
void |
setContentID(String cid)
Set a specific content id
|
void |
setOptimize(boolean value)
Sets the optimize flag.
|
buildWithAttachments, detach, discard, getNextOMSibling, getParent, getPreviousOMSibling, getType, insertSiblingAfter, insertSiblingBefore, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
build, close, isComplete, serialize, serialize, serializeAndConsume
clone, getOMFactory
String getText()
char[] getTextCharacters()
boolean isCharacters()
QName getTextAsQName()
OMElement.getTextAsQName()
to get the QName value of an element.OMNamespace getNamespace()
OMElement.getTextAsQName()
instead.getTextAsQName()
Object getDataHandler()
boolean isOptimized()
void setOptimize(boolean value)
value
- true to optimize binary content (usually w/MTOM)boolean isBinary()
void setBinary(boolean value)
value
- true if the content is binaryString getContentID()
void setContentID(String cid)
cid
- Copyright © The Apache Software Foundation. All Rights Reserved.