public abstract class ParentNode extends ChildNode implements OMContainerEx
Modifier and Type | Field and Description |
---|---|
protected ChildNode |
firstChild |
protected ChildNode |
lastChild |
nextSibling, parentNode, previousSibling
builder, done, factory, FIRSTCHILD, flags, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
DTD_NODE, PI_NODE, SPACE_NODE
Modifier | Constructor and Description |
---|---|
protected |
ParentNode(DocumentImpl ownerDocument,
OMFactory factory) |
protected |
ParentNode(OMFactory factory) |
Modifier and Type | Method and Description |
---|---|
void |
addChild(OMNode omNode)
Adds the given node as the last child.
|
void |
buildNext() |
Node |
cloneNode(boolean deep) |
OMXMLParserWrapper |
getBuilder()
Returns the builder object.
|
NodeList |
getChildNodes() |
Iterator |
getChildren()
Returns an iterator for the children of the container.
|
Iterator |
getChildrenWithLocalName(String localName)
Returns an iterator for child nodes matching the local name.
|
Iterator |
getChildrenWithName(QName elementQName)
Returns an iterator of child nodes having a given qname.
|
Iterator |
getChildrenWithNamespaceURI(String uri)
Returns an iterator for child nodes matching the namespace uri.
|
Node |
getFirstChild()
Gets the first child of this Node, or null if none.
|
OMElement |
getFirstChildWithName(QName elementQName)
Returns the first OMElement child node.
|
OMNode |
getFirstOMChild()
Gets the first child.
|
OMNode |
getFirstOMChildIfAvailable()
Get the first child if it is available.
|
Node |
getLastChild()
Gets the last child of this Node, or null if none.
|
String |
getTextContent() |
javax.xml.stream.XMLStreamReader |
getXMLStreamReader()
Get a pull parser representation of this element with caching enabled.
|
javax.xml.stream.XMLStreamReader |
getXMLStreamReader(boolean cache)
Get a pull parser representation of this element.
|
javax.xml.stream.XMLStreamReader |
getXMLStreamReaderWithoutCaching()
Get a pull parser representation of this element with caching disabled.
|
boolean |
hasChildNodes() |
protected OMNode |
importNode(OMNode child)
This method is intended only to be used by Axiom intenals when merging Objects from different
Axiom implementations to the DOOM implementation.
|
Node |
insertBefore(Node newChild,
Node refChild)
Inserts newChild before the refChild.
|
Node |
removeChild(Node oldChild)
Removes the given child from the DOM Tree.
|
Node |
replaceChild(Node newChild,
Node oldChild)
Replaces the oldChild with the newChild.
|
void |
setFirstChild(OMNode omNode)
forcefully set the first element in this parent element
|
void |
setLastChild(OMNode omNode)
Forcefully set the last child
|
void |
setTextContent(String textContent) |
detach, discard, getNextOMSibling, getNextOMSiblingIfAvailable, getNextSibling, getParent, getParentNode, getPreviousOMSibling, getPreviousSibling, insertSiblingAfter, insertSiblingBefore, setNextOMSibling, setParent, setPreviousOMSibling
appendChild, build, buildWithAttachments, close, compareDocumentPosition, getAttributes, getBaseURI, getFeature, getLength, getLocalName, getNamespaceURI, getNodeValue, getOMFactory, getOwnerDocument, getPrefix, getUserData, hasAttributes, internalSerialize, internalSerializeAndConsume, isComplete, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, serialize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNodeValue, setOwnerDocument, setPrefix, setUserData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setComplete
serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
build, close, getOMFactory, isComplete, serialize, serialize, serializeAndConsume
getNodeName, getNodeType
internalSerialize, setType
protected ParentNode(DocumentImpl ownerDocument, OMFactory factory)
ownerDocument
- protected ParentNode(OMFactory factory)
public OMXMLParserWrapper getBuilder()
OMContainer
getBuilder
in interface OMContainer
public void addChild(OMNode omNode)
OMContainer
addChild
in interface OMContainer
public void buildNext()
buildNext
in interface OMContainer
public Iterator getChildren()
OMContainer
getChildren
in interface OMContainer
Iterator
of children, all of which implement OMNode
.OMContainer.getFirstChildWithName(javax.xml.namespace.QName)
,
OMContainer.getChildrenWithName(javax.xml.namespace.QName)
public Iterator getChildrenWithName(QName elementQName) throws OMException
getChildrenWithName
in interface OMContainer
elementQName
- The QName specifying namespace and local name to match.OMElement
items that match the given QNameOMException
(javax.xml.namespace.QName)
public Iterator getChildrenWithLocalName(String localName)
OMContainer
getChildrenWithLocalName
in interface OMContainer
OMElement
items that match the given localNamepublic Iterator getChildrenWithNamespaceURI(String uri)
OMContainer
getChildrenWithNamespaceURI
in interface OMContainer
OMElement
items that match the given uripublic OMElement getFirstChildWithName(QName elementQName) throws OMException
getFirstChildWithName
in interface OMContainer
elementQName
- The QName to use for matching.qname
criteria, or null
if none is found.OMException
- If an error occurs during deferred parsing.(javax.xml.namespace.QName)
public OMNode getFirstOMChild()
OMContainer
getFirstOMChild
in interface OMContainer
public OMNode getFirstOMChildIfAvailable()
OMContainerEx
OMSerializable.isComplete()
may return false
when called on the child.
In contrast to OMContainer.getFirstOMChild()
, this method will never modify
the state of the underlying parser.getFirstOMChildIfAvailable
in interface OMContainerEx
null
if the container has no children or
the builder has not yet started to build the first childpublic void setFirstChild(OMNode omNode)
OMContainerEx
setFirstChild
in interface OMContainerEx
public void setLastChild(OMNode omNode)
setLastChild
in interface OMContainerEx
omNode
- public NodeList getChildNodes()
getChildNodes
in interface Node
getChildNodes
in class NodeImpl
public Node getFirstChild()
NodeImpl
getFirstChild
in interface Node
getFirstChild
in class NodeImpl
ParentNode
public Node getLastChild()
NodeImpl
getLastChild
in interface Node
getLastChild
in class NodeImpl
ParentNode
public boolean hasChildNodes()
hasChildNodes
in interface Node
hasChildNodes
in class NodeImpl
public Node insertBefore(Node newChild, Node refChild) throws DOMException
insertBefore
in interface Node
insertBefore
in class NodeImpl
DOMException
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
replaceChild
in interface Node
replaceChild
in class NodeImpl
DOMException
public Node removeChild(Node oldChild) throws DOMException
removeChild
in interface Node
removeChild
in class NodeImpl
DOMException
public Node cloneNode(boolean deep)
protected OMNode importNode(OMNode child)
child
- public String getTextContent() throws DOMException
getTextContent
in interface Node
getTextContent
in class NodeImpl
DOMException
public void setTextContent(String textContent) throws DOMException
setTextContent
in interface Node
setTextContent
in class NodeImpl
DOMException
public javax.xml.stream.XMLStreamReader getXMLStreamReaderWithoutCaching()
OMContainer
OMContainer.getXMLStreamReader(boolean)
with cache
set to
false
.getXMLStreamReaderWithoutCaching
in interface OMContainer
XMLStreamReader
representation of this elementpublic javax.xml.stream.XMLStreamReader getXMLStreamReader()
OMContainer
OMContainer.getXMLStreamReader(boolean)
with cache
set to
true
.getXMLStreamReader
in interface OMContainer
XMLStreamReader
representation of this elementpublic javax.xml.stream.XMLStreamReader getXMLStreamReader(boolean cache)
OMContainer
XMLStreamReader
instance that produces a sequence of StAX events for this element and
its content. The sequence of events is independent of the state of this element and the value
of the cache
parameter, but the side effects of calling this method and
consuming the reader are different:
State | cache |
Side effects |
---|---|---|
The element is fully built (or was created programmatically). | true |
No side effects. The reader will synthesize StAX events from the object model. |
false |
||
The element is partially built, i.e. deferred parsing is taking place. | true |
When a StAX event is requested from the reader, it will built the information item (if necessary) and synthesize the StAX event. If the caller completely consumes the reader, the element will be completely built. Otherwise it will be partially built. |
false |
The reader will delegate to the underlying parser starting from the event corresponding to the last information item that has been built. In other words, after synthesizing a number of events, the reader will switch to delegation mode. An attempt to access the object model afterwards will result in an error. |
To free any resources associated with the returned reader, the caller MUST invoke the
XMLStreamReader.close()
method.
The returned reader MAY implement the extension defined by
DataHandlerReader
and any binary content will
be reported using this extension. More precisely, if the object model contains an
OMText
instance with OMText.isBinary()
returning true
(or
would contain such an instance after it has been fully built), then its data will always be
exposed through this extension.
The caller MUST NOT make any other assumption about the returned reader, in particular about its runtime type.
Note (non normative): For various reasons, existing code based on Axiom versions prior to 1.2.9 makes assumptions on the returned reader that should no longer be considered valid:
OMStAXWrapper
. While it is true that Axiom internally uses
this class to synthesize StAX events, it may wrap this instance in another reader
implementation. E.g. depending on the log level, the reader will be wrapped using
OMXMLStreamReaderValidator
. This was already the case in
Axiom versions prior to 1.2.9. It should also be noted that instances of
OMSourcedElement
(which extends the present interface) may return a reader that is
not implemented using OMStAXWrapper
.OMXMLStreamReader
interface of the returned reader to switch
off MTOM inlining using OMXMLStreamReader.setInlineMTOM(boolean)
. This has now been
deprecated and it is recommended to use
XOPEncodingStreamReader
instead.OMAttachmentAccessor
interface of the returned
reader to fetch attachments using OMAttachmentAccessor.getDataHandler(String)
. There
is no reason anymore to do so:OMXMLStreamReader.setInlineMTOM(boolean)
is used to disable MTOM inlining,
OMAttachmentAccessor.getDataHandler(String)
must be used to retrieve the binary
content. The fact that this method is deprecated removes the need for this.OMAttachmentAccessor.getDataHandler(String)
to retrieve the binary content. Starting
with 1.2.9 this is no longer be the case: as specified above, the sequence of events is
independent of the state of the object model and the value of the cache
parameter, and all binary content is reported through the
DataHandlerReader
extension.OMAttachmentAccessor.getDataHandler(String)
doesn't give access to the attachments in the SwA case (neither in 1.2.9 nor in previous
versions).
Code making any of these assumptions should be fixed, so that only XMLStreamReader
and DataHandlerReader
are used (and if
necessary, XOPEncodingStreamReader
).
getXMLStreamReader
in interface OMContainer
cache
- indicates if caching should be enabledXMLStreamReader
representation of this elementCopyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.