Interface OMText
- All Superinterfaces:
OMInformationItem
,OMNode
,OMSerializable
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 Blob
. The latter is used for base64 encoded
binary data.
-
Field Summary
Fields inherited from interface org.apache.axiom.om.OMNode
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE
-
Method Summary
Modifier and TypeMethodDescriptiongetBlob()
Returns aBlob
containing the base64-decoded content of this node.Gets the content id.Deprecated.This API is going away.getText()
Returns the text value of this node.Deprecated.If the underlying parser is non coalescing, then this method may unexpectedly fail or return an incorrect result.char[]
Deprecated.boolean
isBinary()
boolean
Deprecated.boolean
void
setBinary
(boolean value) Sets the isBinary flag.void
setContentID
(String cid) Set a specific content idvoid
setOptimize
(boolean value) Sets the optimize flag.Methods inherited from interface org.apache.axiom.om.OMInformationItem
clone, getOMFactory
Methods inherited from interface org.apache.axiom.om.OMNode
buildWithAttachments, detach, discard, getNextOMSibling, getParent, getPreviousOMSibling, getType, insertSiblingAfter, insertSiblingBefore
Methods inherited from interface org.apache.axiom.om.OMSerializable
build, close, isComplete, serialize, serialize, serializeAndConsume
-
Method Details
-
getText
String getText()Returns the text value of this node.- Returns:
- Returns String.
-
getTextCharacters
char[] getTextCharacters()Deprecated. -
isCharacters
boolean isCharacters()Deprecated. -
getTextAsQName
QName getTextAsQName()Deprecated.If the underlying parser is non coalescing, then this method may unexpectedly fail or return an incorrect result. Always useOMElement.getTextAsQName()
to get the QName value of an element. -
getNamespace
OMNamespace getNamespace()Deprecated.This API is going away. Please useOMElement.getTextAsQName()
instead.- See Also:
-
getBlob
Blob getBlob()Returns aBlob
containing the base64-decoded content of this node.- Returns:
- the base64-decoded content
-
isOptimized
boolean isOptimized()- Returns:
- Returns boolean flag saying whether the node contains an optimized text or not.
-
setOptimize
void setOptimize(boolean value) Sets the optimize flag.- Parameters:
value
- true to optimize binary content (usually w/MTOM)
-
isBinary
boolean isBinary()- Returns:
- Returns boolean flag saying whether the node contains binary or not.
-
setBinary
void setBinary(boolean value) Sets the isBinary flag. Receiving binary can happen as either MTOM attachments or as Base64 Text In the case of Base64 user has to explicitly specify that the content is binary, before calling getDataHandler(), getInputStream()....- Parameters:
value
- true if the content is binary
-
getContentID
String getContentID()Gets the content id.- Returns:
- Returns String.
-
setContentID
Set a specific content id- Parameters:
cid
-
-