Package org.apache.axiom.om
Interface OMNode
-
- All Superinterfaces:
OMSerializable
- All Known Subinterfaces:
OMComment,OMDocType,OMElement,OMNodeEx,OMProcessingInstruction,OMSourcedElement,OMText,SOAPBody,SOAPEnvelope,SOAPFault,SOAPFaultClassifier,SOAPFaultCode,SOAPFaultDetail,SOAPFaultNode,SOAPFaultReason,SOAPFaultRole,SOAPFaultSubCode,SOAPFaultText,SOAPFaultValue,SOAPHeader,SOAPHeaderBlock
public interface OMNode extends OMSerializable
Defines the base interface used by most of the XML object model within Axis. This tree model for XML captures the idea of deferring the construction of child nodes until they are needed. TheisCompletefunction 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, whileOMDocumentandOMAttributeexist, neither is an extension ofOMNode.
-
-
Field Summary
Fields Modifier and Type Field Description static shortCDATA_SECTION_NODEThe node is aCDATASection.static shortCOMMENT_NODEThe node is aComment.static shortDTD_NODEThis node is aDTD.static shortELEMENT_NODEThe node is anElement.static shortENTITY_REFERENCE_NODEThis node is anEntity Reference.static shortPI_NODEThis node is aProcessingInstruction.static shortSPACE_NODEThis node represents white space.static shortTEXT_NODEThe node is aTextnode.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidbuildWithAttachments()Builds itself with the OMText binary content.OMNodedetach()Removes a node (and all of its children) from its containing parent.voiddiscard()Discards a node.OMNodegetNextOMSibling()Returns the next sibling in document order.OMContainergetParent()Returns the parent containing node.OMNodegetPreviousOMSibling()Gets the previous sibling.intgetType()Returns the type of node.voidinsertSiblingAfter(OMNode sibling)Inserts a new sibling after the current node.voidinsertSiblingBefore(OMNode sibling)Inserts a sibling just before the current node.voidserialize(OutputStream output)Deprecated.This method is not meaningful on a node in general, but only on anOMElement.voidserialize(OutputStream output, OMOutputFormat format)Deprecated.This method is not meaningful on a node in general, but only on anOMElement.voidserialize(Writer writer)Deprecated.This method is not meaningful on a node in general, but only on anOMElement.voidserialize(Writer writer, OMOutputFormat format)Deprecated.This method is not meaningful on a node in general, but only on anOMElement.voidserializeAndConsume(OutputStream output)Deprecated.This method is not meaningful on a node in general, but only on anOMElement.voidserializeAndConsume(OutputStream output, OMOutputFormat format)Deprecated.This method is not meaningful on a node in general, but only on anOMElement.voidserializeAndConsume(Writer writer)Deprecated.This method is not meaningful on a node in general, but only on anOMElement.voidserializeAndConsume(Writer writer, OMOutputFormat format)Deprecated.This method is not meaningful on a node in general, but only on anOMElement.-
Methods inherited from interface org.apache.axiom.om.OMSerializable
build, close, getOMFactory, isComplete, serialize, serialize, serializeAndConsume
-
-
-
-
Field Detail
-
ELEMENT_NODE
static final short ELEMENT_NODE
The node is anElement.- See Also:
getType(), Constant Field Values
-
TEXT_NODE
static final short TEXT_NODE
The node is aTextnode.- See Also:
getType(), Constant Field Values
-
CDATA_SECTION_NODE
static final short CDATA_SECTION_NODE
The node is aCDATASection.- See Also:
getType(), Constant Field Values
-
COMMENT_NODE
static final short COMMENT_NODE
The node is aComment.- See Also:
getType(), Constant Field Values
-
DTD_NODE
static final short DTD_NODE
This node is aDTD.- See Also:
getType(), Constant Field Values
-
PI_NODE
static final short PI_NODE
This node is aProcessingInstruction.- See Also:
getType(), Constant Field Values
-
ENTITY_REFERENCE_NODE
static final short ENTITY_REFERENCE_NODE
This node is anEntity Reference.- See Also:
getType(), Constant Field Values
-
SPACE_NODE
static final short SPACE_NODE
This node represents white space.- See Also:
getType(), Constant Field Values
-
-
Method Detail
-
getParent
OMContainer getParent()
Returns the parent containing node. Returns the parent container, which may be either anOMDocumentorOMElement.- Returns:
- The
OMContainerof the node.
-
getNextOMSibling
OMNode getNextOMSibling() throws OMException
Returns the next sibling in document order.- Returns:
- Returns the next sibling in document order.
- Throws:
OMException
-
detach
OMNode detach() throws OMException
Removes a node (and all of its children) from its containing parent. Removes a node from its parent. Partially complete nodes will be completed before they are detached from the model. A node cannot be detached until its next sibling has been identified, so that the next sibling and parent can be updated appropriately. 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.- Throws:
OMException- If a node is not complete, the detach can trigger further parsing, which may cause an exception.
-
discard
void discard() throws OMExceptionDiscards 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
void insertSiblingAfter(OMNode sibling) throws OMException
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
void insertSiblingBefore(OMNode sibling) throws OMException
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_NODEorSPACE_NODE.
-
getPreviousOMSibling
OMNode getPreviousOMSibling()
Gets the previous sibling.- Returns:
- Returns node.
-
serialize
void serialize(OutputStream output) throws XMLStreamException
Deprecated.This method is not meaningful on a node in general, but only on anOMElement.- Throws:
XMLStreamException
-
serialize
void serialize(Writer writer) throws XMLStreamException
Deprecated.This method is not meaningful on a node in general, but only on anOMElement.- Throws:
XMLStreamException
-
serialize
void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException
Deprecated.This method is not meaningful on a node in general, but only on anOMElement.- Throws:
XMLStreamException
-
serialize
void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException
Deprecated.This method is not meaningful on a node in general, but only on anOMElement.- Throws:
XMLStreamException
-
serializeAndConsume
void serializeAndConsume(OutputStream output) throws XMLStreamException
Deprecated.This method is not meaningful on a node in general, but only on anOMElement.- Throws:
XMLStreamException
-
serializeAndConsume
void serializeAndConsume(Writer writer) throws XMLStreamException
Deprecated.This method is not meaningful on a node in general, but only on anOMElement.- Throws:
XMLStreamException
-
serializeAndConsume
void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException
Deprecated.This method is not meaningful on a node in general, but only on anOMElement.- Throws:
XMLStreamException
-
serializeAndConsume
void serializeAndConsume(Writer writer, OMOutputFormat format) throws XMLStreamException
Deprecated.This method is not meaningful on a node in general, but only on anOMElement.- Throws:
XMLStreamException
-
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.
-
-