org.apache.axiom.om
Interface OMNode

All Known Subinterfaces:
OMComment, OMDocType, OMElement, OMNodeEx, OMProcessingInstruction, OMText, SOAPBody, SOAPEnvelope, SOAPFault, SOAPFaultCode, SOAPFaultDetail, SOAPFaultNode, SOAPFaultReason, SOAPFaultRole, SOAPFaultSubCode, SOAPFaultText, SOAPFaultValue, SOAPHeader, SOAPHeaderBlock

public interface OMNode

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. 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
static short CDATA_SECTION_NODE
          The node is a CDATASection.
static short COMMENT_NODE
          The node is a Comment.
static short DTD_NODE
          This node is a DTD.
static short ELEMENT_NODE
          The node is an Element.
static short ENTITY_REFERENCE_NODE
          This node is an Entity Reference.
static short PI_NODE
          This node is a ProcessingInstruction.
static short SPACE_NODE
          This node is an Entity Reference.
static short TEXT_NODE
          The node is a Text node.
 
Method Summary
 void build()
          Builds itself.
 void buildWithAttachments()
          Builds itself with the OMText binary content.
 OMNode detach()
          Removes a node (and all of its children) from its containing parent.
 void discard()
          Discards a node.
 OMNode getNextOMSibling()
          Returns the next sibling in document order.
 OMFactory getOMFactory()
          Returns the OMFactory that created this object
 OMContainer getParent()
          Returns the parent containing node.
 OMNode getPreviousOMSibling()
          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.
 boolean isComplete()
          Indicates whether parser has parsed this information item completely or not.
 void serialize(java.io.OutputStream output)
          Serializes the node with caching.
 void serialize(java.io.OutputStream output, OMOutputFormat format)
          Serializes the node with caching.
 void serialize(java.io.Writer writer)
          Serializes the node with caching.
 void serialize(java.io.Writer writer, OMOutputFormat format)
          Serializes the node with caching.
 void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes the node with caching.
 void serializeAndConsume(java.io.OutputStream output)
          Serializes the node without caching.
 void serializeAndConsume(java.io.OutputStream output, OMOutputFormat format)
          Serializes the node without caching.
 void serializeAndConsume(java.io.Writer writer)
          Serializes the node without caching.
 void serializeAndConsume(java.io.Writer writer, OMOutputFormat format)
          Serializes the node without caching.
 void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes the node without caching.
 

Field Detail

ELEMENT_NODE

public static final short ELEMENT_NODE
The node is an Element.

See Also:
getType(), Constant Field Values

TEXT_NODE

public static final short TEXT_NODE
The node is a Text node.

See Also:
getType(), Constant Field Values

CDATA_SECTION_NODE

public static final short CDATA_SECTION_NODE
The node is a CDATASection.

See Also:
getType(), Constant Field Values

COMMENT_NODE

public static final short COMMENT_NODE
The node is a Comment.

See Also:
getType(), Constant Field Values

DTD_NODE

public static final short DTD_NODE
This node is a DTD.

See Also:
getType(), Constant Field Values

PI_NODE

public static final short PI_NODE
This node is a ProcessingInstruction.

See Also:
getType(), Constant Field Values

ENTITY_REFERENCE_NODE

public static final short ENTITY_REFERENCE_NODE
This node is an Entity Reference.

See Also:
getType(), Constant Field Values

SPACE_NODE

public static final short SPACE_NODE
This node is an Entity Reference.

See Also:
getType(), Constant Field Values
Method Detail

getParent

public OMContainer getParent()
Returns the parent containing node.

Returns the parent container, which may be either an OMDocument or OMElement.

Returns:
The OMContainer of the node.

getNextOMSibling

public OMNode getNextOMSibling()
                        throws OMException
Returns the next sibling in document order.

Returns:
Returns the next sibling in document order.
Throws:
OMException

isComplete

public boolean isComplete()
Indicates whether parser has parsed this information item completely or not. If some info are not available in the item, one has to check this attribute to make sure that, this item has been parsed completely or not.

Returns:
Returns boolean.

detach

public 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

public void discard()
             throws OMException
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

public void insertSiblingAfter(OMNode sibling)
                        throws OMException
Inserts a new sibling after the current node.

Parameters:
sibling - The node that will be added after the current node.
Throws:
OMException

insertSiblingBefore

public void insertSiblingBefore(OMNode sibling)
                         throws OMException
Inserts a sibling just before the current node.

Parameters:
sibling - The node that will be added before the current node.
Throws:
OMException

getType

public 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, SPACE_NODE, or TEXT_NODE.

getPreviousOMSibling

public OMNode getPreviousOMSibling()
Gets the previous sibling.

Returns:
Returns node.

serialize

public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
               throws javax.xml.stream.XMLStreamException
Serializes the node with caching.

Parameters:
xmlWriter -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.OutputStream output)
               throws javax.xml.stream.XMLStreamException
Serializes the node with caching.

Parameters:
output -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.Writer writer)
               throws javax.xml.stream.XMLStreamException
Serializes the node with caching.

Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.OutputStream output,
                      OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Serializes the node with caching.

Parameters:
output -
format -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.Writer writer,
                      OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Serializes the node with caching.

Parameters:
writer -
format -
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
                         throws javax.xml.stream.XMLStreamException
Serializes the node without caching.

Parameters:
xmlWriter -
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.OutputStream output)
                         throws javax.xml.stream.XMLStreamException
Serializes the node without caching.

Parameters:
output -
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.Writer writer)
                         throws javax.xml.stream.XMLStreamException
Serializes the node without caching.

Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.OutputStream output,
                                OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Serializes the node without caching.

Parameters:
output -
format -
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.Writer writer,
                                OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Serializes the node without caching.

Parameters:
writer -
format -
Throws:
javax.xml.stream.XMLStreamException

build

public void build()
Builds itself.


buildWithAttachments

public 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.


getOMFactory

public OMFactory getOMFactory()
Returns the OMFactory that created this object



Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.