public abstract class ParentNode extends ChildNode implements OMContainerEx
| Modifier and Type | Field and Description |
|---|---|
protected ChildNode |
firstChild |
protected ChildNode |
lastChild |
nextSibling, parentNode, previousSiblingbuilder, done, factory, FIRSTCHILD, flags, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIEDATTRIBUTE_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_NODEDTD_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() |
XMLStreamReader |
getXMLStreamReader()
Get a pull parser representation of this element with caching enabled.
|
XMLStreamReader |
getXMLStreamReader(boolean cache)
Get a pull parser representation of this element.
|
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, setPreviousOMSiblingappendChild, 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, setUserDataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetCompleteserialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsumebuild, close, getOMFactory, isComplete, serialize, serialize, serializeAndConsumegetNodeName, getNodeTypeinternalSerialize, setTypeprotected ParentNode(DocumentImpl ownerDocument, OMFactory factory)
ownerDocument - protected ParentNode(OMFactory factory)
public OMXMLParserWrapper getBuilder()
OMContainergetBuilder in interface OMContainerpublic void addChild(OMNode omNode)
OMContaineraddChild in interface OMContainerpublic void buildNext()
buildNext in interface OMContainerpublic Iterator getChildren()
OMContainergetChildren in interface OMContainerIterator 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 OMContainerelementQName - 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)
OMContainergetChildrenWithLocalName in interface OMContainerOMElement items that match the given localNamepublic Iterator getChildrenWithNamespaceURI(String uri)
OMContainergetChildrenWithNamespaceURI in interface OMContainerOMElement items that match the given uripublic OMElement getFirstChildWithName(QName elementQName) throws OMException
getFirstChildWithName in interface OMContainerelementQName - 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()
OMContainergetFirstOMChild in interface OMContainerpublic OMNode getFirstOMChildIfAvailable()
OMContainerExOMSerializable.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 OMContainerExnull if the container has no children or
the builder has not yet started to build the first childpublic void setFirstChild(OMNode omNode)
OMContainerExsetFirstChild in interface OMContainerExpublic void setLastChild(OMNode omNode)
setLastChild in interface OMContainerExomNode - public NodeList getChildNodes()
getChildNodes in interface NodegetChildNodes in class NodeImplpublic Node getFirstChild()
NodeImplgetFirstChild in interface NodegetFirstChild in class NodeImplParentNodepublic Node getLastChild()
NodeImplgetLastChild in interface NodegetLastChild in class NodeImplParentNodepublic boolean hasChildNodes()
hasChildNodes in interface NodehasChildNodes in class NodeImplpublic Node insertBefore(Node newChild, Node refChild) throws DOMException
insertBefore in interface NodeinsertBefore in class NodeImplDOMExceptionpublic Node replaceChild(Node newChild, Node oldChild) throws DOMException
replaceChild in interface NodereplaceChild in class NodeImplDOMExceptionpublic Node removeChild(Node oldChild) throws DOMException
removeChild in interface NoderemoveChild in class NodeImplDOMExceptionpublic Node cloneNode(boolean deep)
protected OMNode importNode(OMNode child)
child - public String getTextContent() throws DOMException
getTextContent in interface NodegetTextContent in class NodeImplDOMExceptionpublic void setTextContent(String textContent) throws DOMException
setTextContent in interface NodesetTextContent in class NodeImplDOMExceptionpublic XMLStreamReader getXMLStreamReaderWithoutCaching()
OMContainerOMContainer.getXMLStreamReader(boolean) with cache set to
false.getXMLStreamReaderWithoutCaching in interface OMContainerXMLStreamReader representation of this elementpublic XMLStreamReader getXMLStreamReader()
OMContainerOMContainer.getXMLStreamReader(boolean) with cache set to
true.getXMLStreamReader in interface OMContainerXMLStreamReader representation of this elementpublic XMLStreamReader getXMLStreamReader(boolean cache)
OMContainerXMLStreamReader 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 OMContainercache - indicates if caching should be enabledXMLStreamReader representation of this elementCopyright © 2004–2016 The Apache Software Foundation. All rights reserved.