public interface OMNode extends OMSerializable
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
.
Modifier and Type | Field and Description |
---|---|
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 represents white space.
|
static short |
TEXT_NODE
The node is a
Text node. |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
void |
serialize(OutputStream output)
Deprecated.
This method is not meaningful on a node in general, but only on an
OMElement . |
void |
serialize(OutputStream output,
OMOutputFormat format)
Deprecated.
This method is not meaningful on a node in general, but only on an
OMElement . |
void |
serialize(Writer writer)
Deprecated.
This method is not meaningful on a node in general, but only on an
OMElement . |
void |
serialize(Writer writer,
OMOutputFormat format)
Deprecated.
This method is not meaningful on a node in general, but only on an
OMElement . |
void |
serializeAndConsume(OutputStream output)
Deprecated.
This method is not meaningful on a node in general, but only on an
OMElement . |
void |
serializeAndConsume(OutputStream output,
OMOutputFormat format)
Deprecated.
This method is not meaningful on a node in general, but only on an
OMElement . |
void |
serializeAndConsume(Writer writer)
Deprecated.
This method is not meaningful on a node in general, but only on an
OMElement . |
void |
serializeAndConsume(Writer writer,
OMOutputFormat format)
Deprecated.
This method is not meaningful on a node in general, but only on an
OMElement . |
build, close, isComplete, serialize, serialize, serializeAndConsume
clone, getOMFactory
static final short ELEMENT_NODE
Element
.getType()
,
Constant Field Valuesstatic final short TEXT_NODE
Text
node.getType()
,
Constant Field Valuesstatic final short CDATA_SECTION_NODE
CDATASection
.getType()
,
Constant Field Valuesstatic final short COMMENT_NODE
Comment
.getType()
,
Constant Field Valuesstatic final short DTD_NODE
DTD
.getType()
,
Constant Field Valuesstatic final short PI_NODE
ProcessingInstruction
.getType()
,
Constant Field Valuesstatic final short ENTITY_REFERENCE_NODE
Entity Reference
.getType()
,
Constant Field Valuesstatic final short SPACE_NODE
getType()
,
Constant Field ValuesOMContainer getParent()
Returns the parent container, which may be either an OMDocument
or OMElement
.
OMContainer
of the node.OMNode getNextOMSibling() throws OMException
OMException
OMNode detach() throws OMException
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.
OMException
- If a node is not complete, the detach can trigger further parsing, which may
cause an exception.void discard() throws OMException
Discard goes to the parser level and if the element is not completely built, then it will be completely skipped at the parser level.
OMException
void insertSiblingAfter(OMNode sibling) throws OMException
sibling
- The node that will be added after the current node.OMException
- if the current node has no parentvoid insertSiblingBefore(OMNode sibling) throws OMException
sibling
- The node that will be added before the current node.OMException
- if the current node has no parentint getType()
ELEMENT_NODE
, TEXT_NODE
, CDATA_SECTION_NODE
,
COMMENT_NODE
, DTD_NODE
, PI_NODE
, ENTITY_REFERENCE_NODE
or SPACE_NODE
.OMNode getPreviousOMSibling()
void serialize(OutputStream output) throws javax.xml.stream.XMLStreamException
OMElement
.void serialize(Writer writer) throws javax.xml.stream.XMLStreamException
OMElement
.void serialize(OutputStream output, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMElement
.void serialize(Writer writer, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMElement
.void serializeAndConsume(OutputStream output) throws javax.xml.stream.XMLStreamException
OMElement
.void serializeAndConsume(Writer writer) throws javax.xml.stream.XMLStreamException
OMElement
.void serializeAndConsume(OutputStream output, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMElement
.void serializeAndConsume(Writer writer, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMElement
.void buildWithAttachments()
Copyright © The Apache Software Foundation. All Rights Reserved.