public class OMElementImpl extends OMNodeImpl implements OMElement, OMConstants, OMContainerEx
| Modifier and Type | Field and Description |
|---|---|
protected java.util.HashMap |
attributes
Field attributes
|
static OMNamespace |
DEFAULT_DEFAULT_NS_OBJECT |
protected OMNode |
firstChild
Field firstChild
|
protected OMNode |
lastChild |
protected java.lang.String |
localName
Field localName
|
protected java.util.HashMap |
namespaces
Field namespaces
|
protected int |
noPrefixNamespaceCounter
Field noPrefixNamespaceCounter
|
protected OMNamespace |
ns
Field ns
|
protected javax.xml.namespace.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(javax.xml.namespace.QName qname,
OMContainer parent,
OMFactory factory)
It is assumed that the QName passed contains, at least, the localName for this element.
|
OMElementImpl(java.lang.String localName,
OMNamespace ns,
OMContainer parent,
OMFactory factory)
This is the basic constructor for OMElement.
|
OMElementImpl(java.lang.String localName,
OMNamespace ns,
OMContainer parent,
OMXMLParserWrapper builder,
OMFactory factory)
Constructor OMElementImpl.
|
OMElementImpl(java.lang.String localName,
OMNamespace ns,
OMFactory factory)
Constructor OMElementImpl.
|
| Modifier and Type | Method and Description |
|---|---|
OMAttribute |
addAttribute(OMAttribute attr)
Inserts an attribute to this element.
|
OMAttribute |
addAttribute(java.lang.String attributeName,
java.lang.String value,
OMNamespace ns) |
void |
addChild(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.
|
OMElement |
cloneOMElement() |
OMNamespace |
declareDefaultNamespace(java.lang.String uri)
We use "" to store the default namespace of this element.
|
OMNamespace |
declareNamespace(OMNamespace namespace) |
OMNamespace |
declareNamespace(java.lang.String uri,
java.lang.String prefix)
Creates a namespace in the current element scope.
|
OMNode |
detach()
Removes this information item and its children, from the model completely.
|
void |
discard()
Method discard.
|
OMNamespace |
findNamespace(java.lang.String uri,
java.lang.String prefix)
Finds a namespace with the given uri and prefix, in the scope of the document.
|
OMNamespace |
findNamespaceURI(java.lang.String prefix) |
java.util.Iterator |
getAllAttributes()
Returns a List of OMAttributes.
|
java.util.Iterator |
getAllDeclaredNamespaces()
Method getAllDeclaredNamespaces.
|
OMAttribute |
getAttribute(javax.xml.namespace.QName qname)
Returns a named attribute if present.
|
java.lang.String |
getAttributeValue(javax.xml.namespace.QName qname)
Returns a named attribute's value, if present.
|
OMXMLParserWrapper |
getBuilder()
Method getBuilder.
|
java.util.Iterator |
getChildElements()
Returns a filtered list of children - just the elements.
|
java.util.Iterator |
getChildren()
Returns a collection of this element.
|
java.util.Iterator |
getChildrenWithLocalName(java.lang.String localName) |
java.util.Iterator |
getChildrenWithName(javax.xml.namespace.QName elementQName)
Searches for children with a given QName and returns an iterator to traverse through the
OMNodes.
|
java.util.Iterator |
getChildrenWithNamespaceURI(java.lang.String uri) |
OMNamespace |
getDefaultNamespace() |
OMElement |
getFirstChildWithName(javax.xml.namespace.QName elementQName)
Method getFirstChildWithName.
|
OMElement |
getFirstElement()
Gets first element.
|
OMNode |
getFirstOMChild()
Method getFirstOMChild.
|
OMNode |
getFirstOMChildIfAvailable() |
int |
getLineNumber() |
java.lang.String |
getLocalName()
Method getLocalName.
|
OMNamespace |
getNamespace() |
OMNode |
getNextOMSibling()
Gets the next sibling.
|
javax.xml.namespace.QName |
getQName()
Method getQName.
|
java.lang.String |
getText()
Selects all the text children and concatenates them to a single string.
|
javax.xml.namespace.QName |
getTextAsQName() |
java.lang.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.
|
javax.xml.stream.XMLStreamReader |
getXMLStreamReader() |
javax.xml.stream.XMLStreamReader |
getXMLStreamReader(boolean cache) |
javax.xml.stream.XMLStreamReader |
getXMLStreamReaderWithoutCaching() |
void |
internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache)
Serializes the node.
|
protected void |
notifyChildComplete()
This method will be called when one of the children becomes complete.
|
void |
removeAttribute(OMAttribute attr)
Method removeAttribute.
|
javax.xml.namespace.QName |
resolveQName(java.lang.String qname)
Converts a prefix:local qname string into a proper QName, evaluating it in the OMElement
context.
|
void |
setBuilder(OMXMLParserWrapper wrapper)
Method setBuilder.
|
void |
setFirstChild(OMNode firstChild)
Method setFirstChild.
|
void |
setLastChild(OMNode omNode) |
void |
setLineNumber(int lineNumber) |
void |
setLocalName(java.lang.String localName)
Method setLocalName.
|
void |
setNamespace(OMNamespace namespace)
Method setNamespace.
|
void |
setNamespaceWithNoFindInCurrentScope(OMNamespace namespace) |
void |
setText(javax.xml.namespace.QName text)
Sets the text, as a QName, of the given element.
|
void |
setText(java.lang.String text)
Sets the text of the given element.
|
java.lang.String |
toString() |
java.lang.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, serializeAndConsumegetParent, getPreviousOMSibling, insertSiblingAfter, insertSiblingBeforesetCompleteclose, getOMFactory, isComplete, serialize, serialize, serializeAndConsumepublic static final OMNamespace DEFAULT_DEFAULT_NS_OBJECT
protected OMNamespace ns
protected java.lang.String localName
protected javax.xml.namespace.QName qName
protected OMNode firstChild
protected java.util.HashMap namespaces
protected java.util.HashMap attributes
protected int noPrefixNamespaceCounter
protected OMNode lastChild
public OMElementImpl(java.lang.String localName,
OMNamespace ns,
OMContainer parent,
OMXMLParserWrapper builder,
OMFactory factory)
public OMElementImpl(java.lang.String localName,
OMNamespace ns,
OMFactory factory)
public OMElementImpl(java.lang.String localName,
OMNamespace ns,
OMContainer parent,
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(javax.xml.namespace.QName qname,
OMContainer parent,
OMFactory factory)
throws OMException
qname - - this should be valid qname according to javax.xml.namespace.QNameOMExceptionpublic void addChild(OMNode child)
addChild in interface OMContainerpublic java.util.Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
getChildrenWithName in interface OMContainerOMExceptionpublic java.util.Iterator getChildrenWithLocalName(java.lang.String localName)
getChildrenWithLocalName in interface OMContainerpublic java.util.Iterator getChildrenWithNamespaceURI(java.lang.String uri)
getChildrenWithNamespaceURI in interface OMContainerpublic OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName) throws OMException
getFirstChildWithName in interface OMContainerOMExceptionpublic OMNode getNextOMSibling() throws OMException
getNextOMSibling in interface OMNodegetNextOMSibling in class OMNodeImplOMExceptionpublic java.util.Iterator getChildren()
getChildren in interface OMContainerpublic java.util.Iterator getChildElements()
getChildElements in interface OMElementpublic OMNamespace declareNamespace(java.lang.String uri, java.lang.String prefix)
declareNamespace in interface OMElementpublic OMNamespace declareDefaultNamespace(java.lang.String uri)
declareDefaultNamespace in interface OMElementuri - public OMNamespace getDefaultNamespace()
getDefaultNamespace in interface OMElementpublic OMNamespace declareNamespace(OMNamespace namespace)
declareNamespace in interface OMElementpublic OMNamespace findNamespace(java.lang.String uri, java.lang.String prefix)
findNamespace in interface OMElementpublic OMNamespace findNamespaceURI(java.lang.String prefix)
findNamespaceURI in interface OMElementpublic java.util.Iterator getAllDeclaredNamespaces()
getAllDeclaredNamespaces in interface OMElementpublic java.util.Iterator getAllAttributes()
getAllAttributes in interface OMElementpublic OMAttribute getAttribute(javax.xml.namespace.QName qname)
getAttribute in interface OMElementqname - the qualified name to search forpublic java.lang.String getAttributeValue(javax.xml.namespace.QName qname)
getAttributeValue in interface OMElementqname - the qualified name to search forpublic OMAttribute addAttribute(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 OMElementOMAttributeImpl.equals(Object)public void removeAttribute(OMAttribute attr)
removeAttribute in interface OMElementpublic OMAttribute addAttribute(java.lang.String attributeName, java.lang.String value, OMNamespace ns)
addAttribute in interface OMElementpublic void setBuilder(OMXMLParserWrapper wrapper)
setBuilder in interface OMElementpublic OMXMLParserWrapper getBuilder()
getBuilder in interface OMContainerpublic void buildNext()
buildNext in interface OMContainerpublic OMNode getFirstOMChild()
getFirstOMChild in interface OMContainerpublic OMNode getFirstOMChildIfAvailable()
getFirstOMChildIfAvailable in interface OMContainerExpublic void setFirstChild(OMNode firstChild)
setFirstChild in interface OMContainerExsetFirstChild in interface OMElementpublic void setLastChild(OMNode omNode)
setLastChild in interface OMContainerExpublic OMNode detach() throws OMException
detach in interface OMNodedetach in class OMNodeImplOMExceptionpublic int getType()
getType in interface OMNodegetType in class OMNodeImplOMNodeImpl.setType(int)OMNodeImpl.setType(int)public void build()
throws OMException
OMSerializableImplbuild in interface OMSerializablebuild in class OMSerializableImplOMExceptionpublic javax.xml.stream.XMLStreamReader getXMLStreamReader()
getXMLStreamReader in interface OMContainerpublic javax.xml.stream.XMLStreamReader getXMLStreamReaderWithoutCaching()
getXMLStreamReaderWithoutCaching in interface OMContainerpublic javax.xml.stream.XMLStreamReader getXMLStreamReader(boolean cache)
getXMLStreamReader in interface OMContainerpublic void setText(java.lang.String text)
public void setText(javax.xml.namespace.QName text)
public java.lang.String getText()
public javax.xml.namespace.QName getTextAsQName()
getTextAsQName in interface OMElementpublic java.lang.String getTrimmedText()
public void internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache)
throws javax.xml.stream.XMLStreamException
OMSerializableImplinternalSerialize in interface OMNodeExinternalSerialize in class OMSerializableImpljavax.xml.stream.XMLStreamExceptionpublic OMElement getFirstElement()
getFirstElement in interface OMElementpublic java.lang.String getLocalName()
getLocalName in interface OMElementpublic void setLocalName(java.lang.String localName)
setLocalName in interface OMElementpublic OMNamespace getNamespace()
getNamespace in interface OMElementpublic void setNamespace(OMNamespace namespace)
setNamespace in interface OMElementpublic void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace)
setNamespaceWithNoFindInCurrentScope in interface OMElementpublic javax.xml.namespace.QName getQName()
public java.lang.String toStringWithConsume()
throws javax.xml.stream.XMLStreamException
toStringWithConsume in interface OMElementjavax.xml.stream.XMLStreamExceptionpublic java.lang.String toString()
public void discard()
throws OMException
discard in interface OMNodeOMExceptionpublic javax.xml.namespace.QName resolveQName(java.lang.String qname)
resolveQName in interface OMElementqname - prefixed qname string to resolvepublic OMElement cloneOMElement()
cloneOMElement in interface OMElementpublic void setLineNumber(int lineNumber)
setLineNumber in interface OMElementpublic int getLineNumber()
getLineNumber in interface OMElementpublic void buildWithAttachments()
OMNodeImplbuildWithAttachments in interface OMNodebuildWithAttachments in class OMNodeImplprotected void notifyChildComplete()
Copyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.