|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.axiom.om.impl.llom.OMNodeImpl
org.apache.axiom.om.impl.llom.OMElementImpl
public class OMElementImpl
Class OMElementImpl
Field Summary | |
---|---|
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
|
Fields inherited from class org.apache.axiom.om.impl.llom.OMNodeImpl |
---|
builder, done, factory, nextSibling, nodeType, parent, previousSibling |
Fields inherited from interface org.apache.axiom.om.OMNode |
---|
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
OMAttribute |
addAttribute(OMAttribute attr)
Inserts an attribute to this element. |
OMAttribute |
addAttribute(java.lang.String attributeName,
java.lang.String value,
OMNamespace ns)
Creates an OMAttributeImpl instance out of the given arguments and
inserts that attribute to this element. |
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()
Clones this element. |
OMNamespace |
declareDefaultNamespace(java.lang.String uri)
We use "" to store the default namespace of this element. |
OMNamespace |
declareNamespace(OMNamespace namespace)
Declares a namespace with the element as its scope. |
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)
Checks for a namespace in the context of this element with the given prefix and returns the relevant namespace object, if available. |
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)
Returns an iterator for child nodes matching the local name. |
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)
Returns an iterator for child nodes matching the namespace uri. |
OMNamespace |
getDefaultNamespace()
This will retrieve the default namespace of this element, if available. |
OMElement |
getFirstChildWithName(javax.xml.namespace.QName elementQName)
Method getFirstChildWithName. |
OMElement |
getFirstElement()
Gets first element. |
OMNode |
getFirstOMChild()
Method getFirstOMChild. |
int |
getLineNumber()
|
java.lang.String |
getLocalName()
Method getLocalName. |
OMNamespace |
getNamespace()
Method 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()
OMText can contain its information as a QName as well. |
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()
Method getXMLStreamReader. |
javax.xml.stream.XMLStreamReader |
getXMLStreamReaderWithoutCaching()
Method getXMLStreamReaderWithoutCaching. |
void |
internalSerialize(javax.xml.stream.XMLStreamWriter writer)
Method internalSerialize. |
protected void |
internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache)
|
void |
internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
This method serializes and consumes without building the object structure in memory. |
boolean |
isComplete()
Method isComplete. |
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)
forcefully set the last element in this parent element |
void |
setLineNumber(int lineNumber)
|
void |
setLocalName(java.lang.String localName)
Method setLocalName. |
void |
setNamespace(OMNamespace namespace)
Method setNamespace. |
void |
setNamespaceWithNoFindInCurrentScope(OMNamespace namespace)
This will not search the namespace in the scope nor will declare in the current element, as in setNamespace(OMNamespace). |
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()
This is a convenience method only. |
java.lang.String |
toStringWithConsume()
This is a convenience method only. |
Methods inherited from class org.apache.axiom.om.impl.llom.OMNodeImpl |
---|
close, getOMFactory, getParent, getPreviousOMSibling, importNode, insertSiblingAfter, insertSiblingBefore, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNextOMSibling, setParent, setPreviousOMSibling, setType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.axiom.om.OMNode |
---|
close, getOMFactory, getParent, getPreviousOMSibling, insertSiblingAfter, insertSiblingBefore, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume |
Methods inherited from interface org.apache.axiom.om.impl.OMContainerEx |
---|
setComplete |
Field Detail |
---|
public 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
Constructor Detail |
---|
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.QName
OMException
Method Detail |
---|
public void addChild(OMNode child)
addChild
in interface OMContainer
public java.util.Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
getChildrenWithName
in interface OMContainer
elementQName
- The QName specifying namespace and local name to match.
OMElement
items that match the given QName
OMException
public java.util.Iterator getChildrenWithLocalName(java.lang.String localName)
OMContainer
getChildrenWithLocalName
in interface OMContainer
OMElement
items that match the given localNamepublic java.util.Iterator getChildrenWithNamespaceURI(java.lang.String uri)
OMContainer
getChildrenWithNamespaceURI
in interface OMContainer
OMElement
items that match the given uripublic OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName) throws OMException
getFirstChildWithName
in interface OMContainer
elementQName
- The QName to use for matching.
OMException
OMContainer.getChildrenWithName(javax.xml.namespace.QName)
public OMNode getNextOMSibling() throws OMException
getNextOMSibling
in interface OMNode
getNextOMSibling
in class OMNodeImpl
OMException
public java.util.Iterator getChildren()
getChildren
in interface OMContainer
OMContainer.getFirstChildWithName(javax.xml.namespace.QName)
,
OMContainer.getChildrenWithName(javax.xml.namespace.QName)
public java.util.Iterator getChildElements()
getChildElements
in interface OMElement
OMContainer.getChildren()
,
OMContainer.getChildrenWithName(javax.xml.namespace.QName)
public OMNamespace declareNamespace(java.lang.String uri, java.lang.String prefix)
declareNamespace
in interface OMElement
uri
- The namespace to declare in the current scope. The caller is expected to
ensure that the URI is a valid namespace name.prefix
- The prefix to associate with the given namespace. The caller is expected to
ensure that this is a valid XML prefix. If "" is given, first this will check
for an existing namespace with the same uri. If not found, a prefix will be
auto-generated.
OMElement.declareNamespace(OMNamespace)
,
OMElement.findNamespace(String, String)
,
OMElement.getAllDeclaredNamespaces()
public OMNamespace declareDefaultNamespace(java.lang.String uri)
declareDefaultNamespace
in interface OMElement
uri
- public OMNamespace getDefaultNamespace()
OMElement
getDefaultNamespace
in interface OMElement
public OMNamespace declareNamespace(OMNamespace namespace)
OMElement
declareNamespace
in interface OMElement
namespace
- The namespace to declare.
OMElement.declareNamespace(String, String)
,
OMElement.findNamespace(String, String)
,
OMElement.getAllDeclaredNamespaces()
public OMNamespace findNamespace(java.lang.String uri, java.lang.String prefix)
findNamespace
in interface OMElement
uri
- The namespace to look for. If this is specified, prefix should be
null.prefix
- The prefix to look for. If this is specified, uri should be null.
OMElement.declareNamespace(String, String)
,
OMElement.declareNamespace(OMNamespace)
,
OMElement.getAllDeclaredNamespaces()
public OMNamespace findNamespaceURI(java.lang.String prefix)
OMElement
findNamespaceURI
in interface OMElement
public java.util.Iterator getAllDeclaredNamespaces()
getAllDeclaredNamespaces
in interface OMElement
OMElement.findNamespace(String, String)
,
OMElement.declareNamespace(String, String)
,
OMElement.declareNamespace(OMNamespace)
public java.util.Iterator getAllAttributes()
getAllAttributes
in interface OMElement
OMElement.getAttribute(javax.xml.namespace.QName)
,
OMElement.addAttribute(OMAttribute)
,
OMElement.addAttribute(String, String, OMNamespace)
public OMAttribute getAttribute(javax.xml.namespace.QName qname)
getAttribute
in interface OMElement
qname
- the qualified name to search for
public java.lang.String getAttributeValue(javax.xml.namespace.QName qname)
getAttributeValue
in interface OMElement
qname
- the qualified name to search for
public 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 OMElement
attr
- The attribute to add.
OMAttributeImpl.equals(Object)
public void removeAttribute(OMAttribute attr)
removeAttribute
in interface OMElement
public OMAttribute addAttribute(java.lang.String attributeName, java.lang.String value, OMNamespace ns)
OMAttributeImpl
instance out of the given arguments and
inserts that attribute to this element. Implementor can decide as to insert this
in the front or at the end of set of attributes.
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 OMElement
attributeName
- The name of the attributevalue
- The value of the attributens
- The namespace of the attribute
OMAttributeImpl.equals(Object)
public void setBuilder(OMXMLParserWrapper wrapper)
setBuilder
in interface OMElement
public OMXMLParserWrapper getBuilder()
getBuilder
in interface OMElement
public void buildNext()
buildNext
in interface OMContainer
public OMNode getFirstOMChild()
getFirstOMChild
in interface OMContainer
public void setFirstChild(OMNode firstChild)
setFirstChild
in interface OMContainerEx
setFirstChild
in interface OMElement
public void setLastChild(OMNode omNode)
OMContainerEx
setLastChild
in interface OMContainerEx
public OMNode detach() throws OMException
detach
in interface OMNode
detach
in class OMNodeImpl
OMException
public boolean isComplete()
isComplete
in interface OMContainer
isComplete
in interface OMNode
isComplete
in class OMNodeImpl
public int getType()
getType
in interface OMNode
getType
in class OMNodeImpl
OMNodeImpl.setType(int)
OMNodeImpl.setType(int)
public void build() throws OMException
OMNodeImpl
build
in interface OMNode
build
in class OMNodeImpl
OMException
public javax.xml.stream.XMLStreamReader getXMLStreamReader()
getXMLStreamReader
in interface OMElement
OMElement.getXMLStreamReader()
public javax.xml.stream.XMLStreamReader getXMLStreamReaderWithoutCaching()
getXMLStreamReaderWithoutCaching
in interface OMElement
OMElement.getXMLStreamReaderWithoutCaching()
public void setText(java.lang.String text)
setText
in interface OMElement
public void setText(javax.xml.namespace.QName text)
setText
in interface OMElement
public java.lang.String getText()
getText
in interface OMElement
public javax.xml.namespace.QName getTextAsQName()
OMElement
getTextAsQName
in interface OMElement
public java.lang.String getTrimmedText()
public void internalSerialize(javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamException
internalSerialize
in interface OMNodeEx
internalSerialize
in class OMNodeImpl
javax.xml.stream.XMLStreamException
protected void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean cache) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamException
internalSerializeAndConsume
in interface OMNodeEx
internalSerializeAndConsume
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public OMElement getFirstElement()
getFirstElement
in interface OMElement
public java.lang.String getLocalName()
getLocalName
in interface OMElement
public void setLocalName(java.lang.String localName)
setLocalName
in interface OMElement
public OMNamespace getNamespace() throws OMException
getNamespace
in interface OMElement
OMException
public void setNamespace(OMNamespace namespace)
setNamespace
in interface OMElement
public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace)
OMElement
setNamespaceWithNoFindInCurrentScope
in interface OMElement
public javax.xml.namespace.QName getQName()
getQName
in interface OMElement
public java.lang.String toStringWithConsume() throws javax.xml.stream.XMLStreamException
OMElement
toStringWithConsume
in interface OMElement
javax.xml.stream.XMLStreamException
public java.lang.String toString()
OMElement
toString
in interface OMElement
toString
in class java.lang.Object
public void discard() throws OMException
discard
in interface OMNode
OMException
public javax.xml.namespace.QName resolveQName(java.lang.String qname)
resolveQName
in interface OMElement
qname
- prefixed qname string to resolve
public OMElement cloneOMElement()
OMElement
cloneOMElement
in interface OMElement
public void setLineNumber(int lineNumber)
setLineNumber
in interface OMElement
public int getLineNumber()
getLineNumber
in interface OMElement
public void buildWithAttachments()
OMNodeImpl
buildWithAttachments
in interface OMNode
buildWithAttachments
in class OMNodeImpl
protected void notifyChildComplete()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |