Interface OMNode
- All Superinterfaces:
OMInformationItem
,OMSerializable
- All Known Subinterfaces:
OMComment
,OMDocType
,OMElement
,OMEntityReference
,OMProcessingInstruction
,OMSourcedElement
,OMText
,SOAPBody
,SOAPEnvelope
,SOAPFault
,SOAPFaultClassifier
,SOAPFaultCode
,SOAPFaultDetail
,SOAPFaultNode
,SOAPFaultReason
,SOAPFaultRole
,SOAPFaultSubCode
,SOAPFaultText
,SOAPFaultValue
,SOAPHeader
,SOAPHeaderBlock
This tree model for XML captures the idea of deferring the construction of child nodes until they
are needed. The isComplete
function identifies whether or not a particular node has
been fully parsed. A node may not be fully parsed, for example, if all of the children of an
element have not yet been parsed.
In comparison to DOM, in this model, you will not find document fragments, or entities. In
addition, while OMDocument
and OMAttribute
exist, neither is an extension of
OMNode
.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final short
The node is aCDATASection
.static final short
The node is aComment
.static final short
This node is aDTD
.static final short
The node is anElement
.static final short
This node is anEntity Reference
.static final short
This node is aProcessingInstruction
.static final short
This node represents white space.static final short
The node is aText
node. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Builds itself with the OMText binary content.detach()
Removes a node (and all of its children) from its containing parent.void
discard()
Discards a node.Returns the next sibling in document order.Returns the parent containing node.Gets the previous sibling.int
getType()
Returns the type of node.void
insertSiblingAfter
(OMNode sibling) Inserts a new sibling after the current node.void
insertSiblingBefore
(OMNode sibling) Inserts a sibling just before the current node.Methods inherited from interface org.apache.axiom.om.OMInformationItem
clone, getOMFactory
Methods inherited from interface org.apache.axiom.om.OMSerializable
build, close, isComplete, serialize, serialize, serializeAndConsume
-
Field Details
-
ELEMENT_NODE
static final short ELEMENT_NODEThe node is anElement
.- See Also:
-
TEXT_NODE
static final short TEXT_NODEThe node is aText
node.- See Also:
-
CDATA_SECTION_NODE
static final short CDATA_SECTION_NODEThe node is aCDATASection
.- See Also:
-
COMMENT_NODE
static final short COMMENT_NODEThe node is aComment
.- See Also:
-
DTD_NODE
static final short DTD_NODEThis node is aDTD
.- See Also:
-
PI_NODE
static final short PI_NODEThis node is aProcessingInstruction
.- See Also:
-
ENTITY_REFERENCE_NODE
static final short ENTITY_REFERENCE_NODEThis node is anEntity Reference
.- See Also:
-
SPACE_NODE
static final short SPACE_NODEThis node represents white space.- See Also:
-
-
Method Details
-
getParent
OMContainer getParent()Returns the parent containing node.Returns the parent container, which may be either an
OMDocument
orOMElement
.- Returns:
- The
OMContainer
of the node.
-
getNextOMSibling
Returns the next sibling in document order.- Returns:
- Returns the next sibling in document order.
- Throws:
OMException
-
detach
Removes a node (and all of its children) from its containing parent.Removes a node from its parent. Please note that this will not handle the namespaces. For example, if there you have used a namespace within the detaching node and which is defined outside the detaching node, user has to handle it manually.
- Returns:
- The detached node. This is always the instance on which this method is invoked.
- Throws:
OMException
-
discard
Discards a node.Discard goes to the parser level and if the element is not completely built, then it will be completely skipped at the parser level.
- Throws:
OMException
-
insertSiblingAfter
Inserts a new sibling after the current node. The current node must have a parent for this operation to succeed. If the node to be inserted has a parent, then it will first be detached.- Parameters:
sibling
- The node that will be added after the current node.- Throws:
OMException
- if the current node has no parent
-
insertSiblingBefore
Inserts a sibling just before the current node. The current node must have a parent for this operation to succeed. If the node to be inserted has a parent, then it will first be detached.- Parameters:
sibling
- The node that will be added before the current node.- Throws:
OMException
- if the current node has no parent
-
getType
int getType()Returns the type of node.- Returns:
- Returns one of
ELEMENT_NODE
,TEXT_NODE
,CDATA_SECTION_NODE
,COMMENT_NODE
,DTD_NODE
,PI_NODE
,ENTITY_REFERENCE_NODE
orSPACE_NODE
.
-
getPreviousOMSibling
OMNode getPreviousOMSibling()Gets the previous sibling.- Returns:
- Returns node.
-
buildWithAttachments
void buildWithAttachments()Builds itself with the OMText binary content. AXIOM supports two levels of deffered building. First is deffered building of AXIOM using StAX. Second level is the deffered building of attachments. AXIOM reads in the attachements from the stream only when user asks by calling getDataHandler(). build() method builds the OM without the attachments. buildAll() builds the OM together with attachement data. This becomes handy when user wants to free the input stream.
-