public class OMElementImpl extends OMNodeImpl implements org.apache.axiom.om.OMElement, org.apache.axiom.om.OMConstants, org.apache.axiom.om.impl.OMContainerEx
| Modifier and Type | Field and Description |
|---|---|
protected HashMap |
attributes
Field attributes
|
static org.apache.axiom.om.OMNamespace |
DEFAULT_DEFAULT_NS_OBJECT |
protected org.apache.axiom.om.OMNode |
firstChild
Field firstChild
|
protected org.apache.axiom.om.OMNode |
lastChild |
protected String |
localName
Field localName
|
protected HashMap |
namespaces
Field namespaces
|
protected int |
noPrefixNamespaceCounter
Field noPrefixNamespaceCounter
|
protected org.apache.axiom.om.OMNamespace |
ns
Field ns
|
protected QName |
qName |
nextSibling, nodeType, parent, previousSiblingbuilder, done, factoryCDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODEARRAY_ITEM_LOCALNAME, ARRAY_ITEM_NS_PREFIX, ARRAY_ITEM_NSURI, ARRAY_ITEM_QNAME, DATA_HANDLER, DEFAULT_CHAR_SET_ENCODING, DEFAULT_DEFAULT_NAMESPACE, DEFAULT_XML_VERSION, IS_BINARY, IS_DATA_HANDLERS_AWARE, PULL_TYPE_BUILDER, PUSH_TYPE_BUILDER, XMLATTRTYPE_CDATA, XMLATTRTYPE_ENTITIES, XMLATTRTYPE_ENTITY, XMLATTRTYPE_ID, XMLATTRTYPE_IDREF, XMLATTRTYPE_IDREFS, XMLATTRTYPE_NMTOKEN, XMLATTRTYPE_NMTOKENS, XMLATTRTYPE_NOTATION, XMLNS_NS_PREFIX, XMLNS_NS_URI, XMLNS_PREFIX, XMLNS_URI| Constructor and Description |
|---|
OMElementImpl(QName qname,
org.apache.axiom.om.OMContainer parent,
org.apache.axiom.om.OMFactory factory)
It is assumed that the QName passed contains, at least, the localName for this element.
|
OMElementImpl(String localName,
org.apache.axiom.om.OMNamespace ns,
org.apache.axiom.om.OMContainer parent,
org.apache.axiom.om.OMFactory factory)
This is the basic constructor for OMElement.
|
OMElementImpl(String localName,
org.apache.axiom.om.OMNamespace ns,
org.apache.axiom.om.OMContainer parent,
org.apache.axiom.om.OMXMLParserWrapper builder,
org.apache.axiom.om.OMFactory factory)
Constructor OMElementImpl.
|
OMElementImpl(String localName,
org.apache.axiom.om.OMNamespace ns,
org.apache.axiom.om.OMFactory factory)
Constructor OMElementImpl.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.axiom.om.OMAttribute |
addAttribute(org.apache.axiom.om.OMAttribute attr)
Inserts an attribute to this element.
|
org.apache.axiom.om.OMAttribute |
addAttribute(String attributeName,
String value,
org.apache.axiom.om.OMNamespace ns) |
void |
addChild(org.apache.axiom.om.OMNode child)
Adds child to the element.
|
void |
build()
Parses this node and builds the object structure in memory.
|
void |
buildNext()
Forces the parser to proceed, if parser has not yet finished with the XML input.
|
void |
buildWithAttachments()
Parses this node and builds the object structure in memory.
|
org.apache.axiom.om.OMElement |
cloneOMElement() |
org.apache.axiom.om.OMNamespace |
declareDefaultNamespace(String uri)
We use "" to store the default namespace of this element.
|
org.apache.axiom.om.OMNamespace |
declareNamespace(org.apache.axiom.om.OMNamespace namespace) |
org.apache.axiom.om.OMNamespace |
declareNamespace(String uri,
String prefix)
Creates a namespace in the current element scope.
|
org.apache.axiom.om.OMNode |
detach()
Removes this information item and its children, from the model completely.
|
void |
discard()
Method discard.
|
org.apache.axiom.om.OMNamespace |
findNamespace(String uri,
String prefix)
Finds a namespace with the given uri and prefix, in the scope of the document.
|
org.apache.axiom.om.OMNamespace |
findNamespaceURI(String prefix) |
Iterator |
getAllAttributes()
Returns a List of OMAttributes.
|
Iterator |
getAllDeclaredNamespaces()
Method getAllDeclaredNamespaces.
|
org.apache.axiom.om.OMAttribute |
getAttribute(QName qname)
Returns a named attribute if present.
|
String |
getAttributeValue(QName qname)
Returns a named attribute's value, if present.
|
org.apache.axiom.om.OMXMLParserWrapper |
getBuilder()
Method getBuilder.
|
Iterator |
getChildElements()
Returns a filtered list of children - just the elements.
|
Iterator |
getChildren()
Returns a collection of this element.
|
Iterator |
getChildrenWithLocalName(String localName) |
Iterator |
getChildrenWithName(QName elementQName)
Searches for children with a given QName and returns an iterator to traverse through the
OMNodes.
|
Iterator |
getChildrenWithNamespaceURI(String uri) |
org.apache.axiom.om.OMNamespace |
getDefaultNamespace() |
org.apache.axiom.om.OMElement |
getFirstChildWithName(QName elementQName)
Method getFirstChildWithName.
|
org.apache.axiom.om.OMElement |
getFirstElement()
Gets first element.
|
org.apache.axiom.om.OMNode |
getFirstOMChild()
Method getFirstOMChild.
|
org.apache.axiom.om.OMNode |
getFirstOMChildIfAvailable() |
int |
getLineNumber() |
String |
getLocalName()
Method getLocalName.
|
org.apache.axiom.om.OMNamespace |
getNamespace() |
org.apache.axiom.om.OMNode |
getNextOMSibling()
Gets the next sibling.
|
QName |
getQName()
Method getQName.
|
String |
getText()
Selects all the text children and concatenates them to a single string.
|
QName |
getTextAsQName() |
String |
getTrimmedText()
Returns the concatination string of TRIMMED values of all OMText child nodes of this
element.
|
int |
getType()
Gets the type of node, as this is the super class of all the nodes.
|
XMLStreamReader |
getXMLStreamReader() |
XMLStreamReader |
getXMLStreamReader(boolean cache) |
XMLStreamReader |
getXMLStreamReader(boolean cache,
boolean preserveNamespaceContext) |
XMLStreamReader |
getXMLStreamReaderWithoutCaching() |
void |
internalSerialize(XMLStreamWriter writer,
boolean cache)
Serializes the node.
|
protected void |
notifyChildComplete()
This method will be called when one of the children becomes complete.
|
void |
removeAttribute(org.apache.axiom.om.OMAttribute attr)
Method removeAttribute.
|
QName |
resolveQName(String qname)
Converts a prefix:local qname string into a proper QName, evaluating it in the OMElement
context.
|
void |
setBuilder(org.apache.axiom.om.OMXMLParserWrapper wrapper)
Method setBuilder.
|
void |
setFirstChild(org.apache.axiom.om.OMNode firstChild)
Method setFirstChild.
|
void |
setLastChild(org.apache.axiom.om.OMNode omNode) |
void |
setLineNumber(int lineNumber) |
void |
setLocalName(String localName)
Method setLocalName.
|
void |
setNamespace(org.apache.axiom.om.OMNamespace namespace)
Method setNamespace.
|
void |
setNamespaceWithNoFindInCurrentScope(org.apache.axiom.om.OMNamespace namespace) |
void |
setText(QName text)
Sets the text, as a QName, of the given element.
|
void |
setText(String text)
Sets the text of the given element.
|
String |
toString() |
String |
toStringWithConsume() |
getNextOMSiblingIfAvailable, getParent, getPreviousOMSibling, importNode, insertSiblingAfter, insertSiblingBefore, internalSerialize, internalSerializeAndConsume, setComplete, setNextOMSibling, setParent, setPreviousOMSibling, setTypeclose, getOMFactory, isComplete, serialize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsumeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitserialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsumepublic static final org.apache.axiom.om.OMNamespace DEFAULT_DEFAULT_NS_OBJECT
protected org.apache.axiom.om.OMNamespace ns
protected String localName
protected QName qName
protected org.apache.axiom.om.OMNode firstChild
protected HashMap namespaces
protected HashMap attributes
protected int noPrefixNamespaceCounter
protected org.apache.axiom.om.OMNode lastChild
public OMElementImpl(String localName, org.apache.axiom.om.OMNamespace ns, org.apache.axiom.om.OMContainer parent, org.apache.axiom.om.OMXMLParserWrapper builder, org.apache.axiom.om.OMFactory factory)
public OMElementImpl(String localName, org.apache.axiom.om.OMNamespace ns, org.apache.axiom.om.OMFactory factory)
public OMElementImpl(String localName, org.apache.axiom.om.OMNamespace ns, org.apache.axiom.om.OMContainer parent, org.apache.axiom.om.OMFactory factory)
localName - - this MUST always be not nullns - - can be nullparent - - this should be an OMContainerfactory - - factory that created this OMElement
A null namespace indicates that the default namespace in scope is usedpublic OMElementImpl(QName qname, org.apache.axiom.om.OMContainer parent, org.apache.axiom.om.OMFactory factory) throws org.apache.axiom.om.OMException
qname - - this should be valid qname according to javax.xml.namespace.QNameorg.apache.axiom.om.OMExceptionpublic void addChild(org.apache.axiom.om.OMNode child)
addChild in interface org.apache.axiom.om.OMContainerpublic Iterator getChildrenWithName(QName elementQName)
getChildrenWithName in interface org.apache.axiom.om.OMContainerorg.apache.axiom.om.OMExceptionpublic Iterator getChildrenWithLocalName(String localName)
getChildrenWithLocalName in interface org.apache.axiom.om.OMContainerpublic Iterator getChildrenWithNamespaceURI(String uri)
getChildrenWithNamespaceURI in interface org.apache.axiom.om.OMContainerpublic org.apache.axiom.om.OMElement getFirstChildWithName(QName elementQName) throws org.apache.axiom.om.OMException
getFirstChildWithName in interface org.apache.axiom.om.OMContainerorg.apache.axiom.om.OMExceptionpublic org.apache.axiom.om.OMNode getNextOMSibling()
throws org.apache.axiom.om.OMException
getNextOMSibling in interface org.apache.axiom.om.OMNodegetNextOMSibling in class OMNodeImplorg.apache.axiom.om.OMExceptionpublic Iterator getChildren()
getChildren in interface org.apache.axiom.om.OMContainerpublic Iterator getChildElements()
getChildElements in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMNamespace declareNamespace(String uri, String prefix)
declareNamespace in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMNamespace declareDefaultNamespace(String uri)
declareDefaultNamespace in interface org.apache.axiom.om.OMElementuri - public org.apache.axiom.om.OMNamespace getDefaultNamespace()
getDefaultNamespace in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMNamespace declareNamespace(org.apache.axiom.om.OMNamespace namespace)
declareNamespace in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMNamespace findNamespace(String uri, String prefix)
findNamespace in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMNamespace findNamespaceURI(String prefix)
findNamespaceURI in interface org.apache.axiom.om.OMElementpublic Iterator getAllDeclaredNamespaces()
getAllDeclaredNamespaces in interface org.apache.axiom.om.OMElementpublic Iterator getAllAttributes()
getAllAttributes in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMAttribute getAttribute(QName qname)
getAttribute in interface org.apache.axiom.om.OMElementqname - the qualified name to search forpublic String getAttributeValue(QName qname)
getAttributeValue in interface org.apache.axiom.om.OMElementqname - the qualified name to search forpublic org.apache.axiom.om.OMAttribute addAttribute(org.apache.axiom.om.OMAttribute attr)
The owner of the attribute is set to be the particular OMElement.
If the attribute already has an owner then the attribute is cloned (i.e. its name,
value and namespace are copied to a new attribute) and the new attribute is added
to the element. It's owner is then set to be the particular OMElement.
addAttribute in interface org.apache.axiom.om.OMElementOMAttributeImpl.equals(Object)public void removeAttribute(org.apache.axiom.om.OMAttribute attr)
removeAttribute in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMAttribute addAttribute(String attributeName, String value, org.apache.axiom.om.OMNamespace ns)
addAttribute in interface org.apache.axiom.om.OMElementpublic void setBuilder(org.apache.axiom.om.OMXMLParserWrapper wrapper)
setBuilder in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMXMLParserWrapper getBuilder()
getBuilder in interface org.apache.axiom.om.OMContainerpublic void buildNext()
buildNext in interface org.apache.axiom.om.OMContainerpublic org.apache.axiom.om.OMNode getFirstOMChild()
getFirstOMChild in interface org.apache.axiom.om.OMContainerpublic org.apache.axiom.om.OMNode getFirstOMChildIfAvailable()
getFirstOMChildIfAvailable in interface org.apache.axiom.om.impl.OMContainerExpublic void setFirstChild(org.apache.axiom.om.OMNode firstChild)
setFirstChild in interface org.apache.axiom.om.impl.OMContainerExsetFirstChild in interface org.apache.axiom.om.OMElementpublic void setLastChild(org.apache.axiom.om.OMNode omNode)
setLastChild in interface org.apache.axiom.om.impl.OMContainerExpublic org.apache.axiom.om.OMNode detach()
throws org.apache.axiom.om.OMException
detach in interface org.apache.axiom.om.OMNodedetach in class OMNodeImplorg.apache.axiom.om.OMExceptionpublic int getType()
getType in interface org.apache.axiom.om.OMNodegetType in class OMNodeImplOMNodeImpl.setType(int)OMNodeImpl.setType(int)public void build()
throws org.apache.axiom.om.OMException
OMSerializableImplbuild in interface org.apache.axiom.om.OMSerializablebuild in class OMSerializableImplorg.apache.axiom.om.OMExceptionpublic XMLStreamReader getXMLStreamReader()
getXMLStreamReader in interface org.apache.axiom.om.OMContainerpublic XMLStreamReader getXMLStreamReaderWithoutCaching()
getXMLStreamReaderWithoutCaching in interface org.apache.axiom.om.OMContainerpublic XMLStreamReader getXMLStreamReader(boolean cache)
getXMLStreamReader in interface org.apache.axiom.om.OMContainerpublic XMLStreamReader getXMLStreamReader(boolean cache, boolean preserveNamespaceContext)
getXMLStreamReader in interface org.apache.axiom.om.OMElementpublic void setText(String text)
setText in interface org.apache.axiom.om.OMElementpublic void setText(QName text)
setText in interface org.apache.axiom.om.OMElementpublic String getText()
getText in interface org.apache.axiom.om.OMElementpublic QName getTextAsQName()
getTextAsQName in interface org.apache.axiom.om.OMElementpublic String getTrimmedText()
public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException
OMSerializableImplinternalSerialize in interface org.apache.axiom.om.impl.OMNodeExinternalSerialize in class OMSerializableImplXMLStreamExceptionpublic org.apache.axiom.om.OMElement getFirstElement()
getFirstElement in interface org.apache.axiom.om.OMElementpublic String getLocalName()
getLocalName in interface org.apache.axiom.om.OMElementpublic void setLocalName(String localName)
setLocalName in interface org.apache.axiom.om.OMElementpublic org.apache.axiom.om.OMNamespace getNamespace()
getNamespace in interface org.apache.axiom.om.OMElementpublic void setNamespace(org.apache.axiom.om.OMNamespace namespace)
setNamespace in interface org.apache.axiom.om.OMElementpublic void setNamespaceWithNoFindInCurrentScope(org.apache.axiom.om.OMNamespace namespace)
setNamespaceWithNoFindInCurrentScope in interface org.apache.axiom.om.OMElementpublic QName getQName()
getQName in interface org.apache.axiom.om.OMElementpublic String toStringWithConsume() throws XMLStreamException
toStringWithConsume in interface org.apache.axiom.om.OMElementXMLStreamExceptionpublic String toString()
public void discard()
throws org.apache.axiom.om.OMException
discard in interface org.apache.axiom.om.OMNodeorg.apache.axiom.om.OMExceptionpublic QName resolveQName(String qname)
resolveQName in interface org.apache.axiom.om.OMElementqname - prefixed qname string to resolvepublic org.apache.axiom.om.OMElement cloneOMElement()
cloneOMElement in interface org.apache.axiom.om.OMElementpublic void setLineNumber(int lineNumber)
setLineNumber in interface org.apache.axiom.om.OMElementpublic int getLineNumber()
getLineNumber in interface org.apache.axiom.om.OMElementpublic void buildWithAttachments()
OMNodeImplbuildWithAttachments in interface org.apache.axiom.om.OMNodebuildWithAttachments in class OMNodeImplprotected void notifyChildComplete()
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.