|
||||||||||
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
org.apache.axiom.om.impl.llom.OMSourcedElementImpl
public class OMSourcedElementImpl
Element backed by an arbitrary data source. When necessary, this element will be expanded by creating a parser from the data source.
Whenever methods are added to the base OMElementImpl
class the corresponding methods must be added to this class (there's a unit test to verify that
this has been done, just to make sure nothing gets accidentally broken). If the method only
requires the element name and/or namespace information, the base class method can be called
directly. Otherwise, the element must be expanded into a full OM tree (by calling the forceExpand()
method) before the base class method is called. This will typically involve a
heavy overhead penalty, so should be avoided if possible.
Field Summary |
---|
Fields inherited from class org.apache.axiom.om.impl.llom.OMElementImpl |
---|
attributes, DEFAULT_DEFAULT_NS_OBJECT, firstChild, lastChild, localName, namespaces, noPrefixNamespaceCounter, ns, 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 | |
---|---|
OMSourcedElementImpl(javax.xml.namespace.QName qName,
OMFactory factory,
OMDataSource source)
Constructor that takes a QName instead of the local name and the namespace seperately |
|
OMSourcedElementImpl(String localName,
OMNamespace ns,
OMContainer parent,
OMFactory factory)
|
|
OMSourcedElementImpl(String localName,
OMNamespace ns,
OMContainer parent,
OMXMLParserWrapper builder,
OMFactory factory)
|
|
OMSourcedElementImpl(String localName,
OMNamespace ns,
OMFactory factory)
|
|
OMSourcedElementImpl(String localName,
OMNamespace ns,
OMFactory factory,
OMDataSource source)
Constructor. |
Method Summary | |
---|---|
OMAttribute |
addAttribute(OMAttribute attr)
Inserts an attribute to this element. |
OMAttribute |
addAttribute(String attributeName,
String value,
OMNamespace namespace)
Creates an OMAttributeImpl instance out of the given arguments and
inserts that attribute to this element. |
void |
addChild(OMNode omNode)
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(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(String uri,
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(String uri,
String prefix)
Finds a namespace with the given uri and prefix, in the scope of the document. |
OMNamespace |
findNamespaceURI(String prefix)
Checks for a namespace in the context of this element with the given prefix and returns the relevant namespace object, if available. |
Iterator |
getAllAttributes()
Returns a List of OMAttributes. |
Iterator |
getAllDeclaredNamespaces()
Method getAllDeclaredNamespaces. |
OMAttribute |
getAttribute(javax.xml.namespace.QName qname)
Returns a named attribute if present. |
String |
getAttributeValue(javax.xml.namespace.QName qname)
Returns a named attribute's value, if present. |
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)
Returns an iterator for child nodes matching the local name. |
Iterator |
getChildrenWithName(javax.xml.namespace.QName elementQName)
Searches for children with a given QName and returns an iterator to traverse through the OMNodes. |
Iterator |
getChildrenWithNamespaceURI(String uri)
Returns an iterator for child nodes matching the namespace uri. |
OMDataSource |
getDataSource()
Provide access to the data source encapsulated in OMSourcedElement. |
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()
|
String |
getLocalName()
Method getLocalName. |
OMNamespace |
getNamespace()
Method getNamespace. |
OMNode |
getNextOMSibling()
Gets the next sibling. |
javax.xml.namespace.QName |
getQName()
Method getQName. |
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. |
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. |
boolean |
isExpanded()
Check if element has been expanded into tree. |
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(String qname)
Converts a prefix:local qname string into a proper QName, evaluating it in the OMElement context. |
void |
serialize(OutputStream output)
Serializes the node with caching. |
void |
serialize(OutputStream output,
OMOutputFormat format)
Serializes the node with caching. |
void |
serialize(Writer writer)
Serializes the node with caching. |
void |
serialize(Writer writer,
OMOutputFormat format)
Serializes the node with caching. |
void |
serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
Serializes the node with caching. |
void |
serializeAndConsume(OutputStream output)
Serializes the node without caching. |
void |
serializeAndConsume(OutputStream output,
OMOutputFormat format)
Serializes the node without caching. |
void |
serializeAndConsume(Writer writer)
Serializes the node without caching. |
void |
serializeAndConsume(Writer writer,
OMOutputFormat format)
Serializes the node without caching. |
void |
serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
Serializes the node without caching. |
void |
setBuilder(OMXMLParserWrapper wrapper)
Method setBuilder. |
void |
setComplete(boolean value)
setComplete override The OMSourcedElement has its own isolated builder/reader during the expansion process. |
OMDataSource |
setDataSource(OMDataSource dataSource)
setOMDataSource |
void |
setFirstChild(OMNode node)
Method setFirstChild. |
void |
setLastChild(OMNode omNode)
forcefully set the last element in this parent element |
void |
setLineNumber(int lineNumber)
|
void |
setLocalName(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(String text)
Sets the text of the given element. |
String |
toString()
This is a convenience method only. |
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, 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 |
Constructor Detail |
---|
public OMSourcedElementImpl(String localName, OMNamespace ns, OMFactory factory, OMDataSource source)
localName
- ns
- factory
- source
- public OMSourcedElementImpl(javax.xml.namespace.QName qName, OMFactory factory, OMDataSource source)
qName
- factory
- source
- public OMSourcedElementImpl(String localName, OMNamespace ns, OMContainer parent, OMFactory factory)
public OMSourcedElementImpl(String localName, OMNamespace ns, OMContainer parent, OMXMLParserWrapper builder, OMFactory factory)
public OMSourcedElementImpl(String localName, OMNamespace ns, OMFactory factory)
Method Detail |
---|
public boolean isExpanded()
isExpanded
in interface OMSourcedElement
true
if expanded, false
if notpublic Iterator getChildElements()
OMElementImpl
getChildElements
in interface OMElement
getChildElements
in class OMElementImpl
OMContainer.getChildren()
,
OMContainer.getChildrenWithName(javax.xml.namespace.QName)
public OMNamespace declareNamespace(String uri, String prefix)
OMElementImpl
declareNamespace
in interface OMElement
declareNamespace
in class OMElementImpl
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(String uri)
OMElementImpl
declareDefaultNamespace
in interface OMElement
declareDefaultNamespace
in class OMElementImpl
public OMNamespace getDefaultNamespace()
OMElement
getDefaultNamespace
in interface OMElement
getDefaultNamespace
in class OMElementImpl
public OMNamespace declareNamespace(OMNamespace namespace)
OMElement
declareNamespace
in interface OMElement
declareNamespace
in class OMElementImpl
namespace
- The namespace to declare.
OMElement.declareNamespace(String, String)
,
OMElement.findNamespace(String, String)
,
OMElement.getAllDeclaredNamespaces()
public OMNamespace findNamespace(String uri, String prefix)
OMElementImpl
findNamespace
in interface OMElement
findNamespace
in class OMElementImpl
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(String prefix)
OMElement
findNamespaceURI
in interface OMElement
findNamespaceURI
in class OMElementImpl
public Iterator getAllDeclaredNamespaces() throws OMException
OMElementImpl
getAllDeclaredNamespaces
in interface OMElement
getAllDeclaredNamespaces
in class OMElementImpl
OMException
OMElement.findNamespace(String, String)
,
OMElement.declareNamespace(String, String)
,
OMElement.declareNamespace(OMNamespace)
public Iterator getAllAttributes()
OMElementImpl
getAllAttributes
in interface OMElement
getAllAttributes
in class OMElementImpl
OMElement.getAttribute(javax.xml.namespace.QName)
,
OMElement.addAttribute(OMAttribute)
,
OMElement.addAttribute(String, String, OMNamespace)
public OMAttribute getAttribute(javax.xml.namespace.QName qname)
OMElementImpl
getAttribute
in interface OMElement
getAttribute
in class OMElementImpl
qname
- the qualified name to search for
public String getAttributeValue(javax.xml.namespace.QName qname)
OMElementImpl
getAttributeValue
in interface OMElement
getAttributeValue
in class OMElementImpl
qname
- the qualified name to search for
public OMAttribute addAttribute(OMAttribute attr)
OMElementImpl
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
addAttribute
in class OMElementImpl
attr
- The attribute to add.
OMAttributeImpl.equals(Object)
public OMAttribute addAttribute(String attributeName, String value, OMNamespace namespace)
OMElementImpl
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
addAttribute
in class OMElementImpl
attributeName
- The name of the attributevalue
- The value of the attributenamespace
- The namespace of the attribute
OMAttributeImpl.equals(Object)
public void removeAttribute(OMAttribute attr)
OMElementImpl
removeAttribute
in interface OMElement
removeAttribute
in class OMElementImpl
public void setBuilder(OMXMLParserWrapper wrapper)
OMElementImpl
setBuilder
in interface OMElement
setBuilder
in class OMElementImpl
public OMXMLParserWrapper getBuilder()
OMElementImpl
getBuilder
in interface OMElement
getBuilder
in class OMElementImpl
public void setFirstChild(OMNode node)
OMElementImpl
setFirstChild
in interface OMContainerEx
setFirstChild
in interface OMElement
setFirstChild
in class OMElementImpl
public void setLastChild(OMNode omNode)
OMContainerEx
setLastChild
in interface OMContainerEx
setLastChild
in class OMElementImpl
public OMElement getFirstElement()
OMElementImpl
getFirstElement
in interface OMElement
getFirstElement
in class OMElementImpl
public javax.xml.stream.XMLStreamReader getXMLStreamReader()
OMElementImpl
getXMLStreamReader
in interface OMElement
getXMLStreamReader
in class OMElementImpl
OMElement.getXMLStreamReader()
public javax.xml.stream.XMLStreamReader getXMLStreamReaderWithoutCaching()
OMElementImpl
getXMLStreamReaderWithoutCaching
in interface OMElement
getXMLStreamReaderWithoutCaching
in class OMElementImpl
OMElement.getXMLStreamReaderWithoutCaching()
public void setText(String text)
OMElementImpl
setText
in interface OMElement
setText
in class OMElementImpl
public void setText(javax.xml.namespace.QName text)
OMElementImpl
setText
in interface OMElement
setText
in class OMElementImpl
public String getText()
OMElementImpl
getText
in interface OMElement
getText
in class OMElementImpl
public javax.xml.namespace.QName getTextAsQName()
OMElement
getTextAsQName
in interface OMElement
getTextAsQName
in class OMElementImpl
public String getLocalName()
OMElementImpl
getLocalName
in interface OMElement
getLocalName
in class OMElementImpl
public void setLocalName(String localName)
OMElementImpl
setLocalName
in interface OMElement
setLocalName
in class OMElementImpl
public OMNamespace getNamespace() throws OMException
OMElementImpl
getNamespace
in interface OMElement
getNamespace
in class OMElementImpl
OMException
public void setNamespace(OMNamespace namespace)
OMElementImpl
setNamespace
in interface OMElement
setNamespace
in class OMElementImpl
public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace)
OMElement
setNamespaceWithNoFindInCurrentScope
in interface OMElement
setNamespaceWithNoFindInCurrentScope
in class OMElementImpl
public javax.xml.namespace.QName getQName()
OMElementImpl
getQName
in interface OMElement
getQName
in class OMElementImpl
public String toStringWithConsume() throws javax.xml.stream.XMLStreamException
OMElement
toStringWithConsume
in interface OMElement
toStringWithConsume
in class OMElementImpl
javax.xml.stream.XMLStreamException
public javax.xml.namespace.QName resolveQName(String qname)
OMElementImpl
resolveQName
in interface OMElement
resolveQName
in class OMElementImpl
qname
- prefixed qname string to resolve
public OMElement cloneOMElement()
OMElement
cloneOMElement
in interface OMElement
cloneOMElement
in class OMElementImpl
public void setLineNumber(int lineNumber)
setLineNumber
in interface OMElement
setLineNumber
in class OMElementImpl
public int getLineNumber()
getLineNumber
in interface OMElement
getLineNumber
in class OMElementImpl
public void discard() throws OMException
OMElementImpl
discard
in interface OMNode
discard
in class OMElementImpl
OMException
public int getType()
OMElementImpl
getType
in interface OMNode
getType
in class OMElementImpl
OMNodeImpl.setType(int)
OMNodeImpl.setType(int)
public void internalSerialize(javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamException
OMElementImpl
internalSerialize
in interface OMNodeEx
internalSerialize
in class OMElementImpl
javax.xml.stream.XMLStreamException
protected void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean cache) throws javax.xml.stream.XMLStreamException
internalSerialize
in class OMElementImpl
javax.xml.stream.XMLStreamException
public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamException
OMElementImpl
internalSerializeAndConsume
in interface OMNodeEx
internalSerializeAndConsume
in class OMElementImpl
javax.xml.stream.XMLStreamException
public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException
OMNodeImpl
serialize
in interface OMNode
serialize
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serialize(OutputStream output) throws javax.xml.stream.XMLStreamException
OMNode
serialize
in interface OMNode
serialize
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serialize(Writer writer) throws javax.xml.stream.XMLStreamException
OMNode
serialize
in interface OMNode
serialize
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serialize(OutputStream output, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMNode
serialize
in interface OMNode
serialize
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serialize(Writer writer, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMNode
serialize
in interface OMNode
serialize
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException
OMNodeImpl
serializeAndConsume
in interface OMNode
serializeAndConsume
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serializeAndConsume(OutputStream output) throws javax.xml.stream.XMLStreamException
OMNode
serializeAndConsume
in interface OMNode
serializeAndConsume
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serializeAndConsume(Writer writer) throws javax.xml.stream.XMLStreamException
OMNode
serializeAndConsume
in interface OMNode
serializeAndConsume
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMNode
serializeAndConsume
in interface OMNode
serializeAndConsume
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void serializeAndConsume(Writer writer, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMNode
serializeAndConsume
in interface OMNode
serializeAndConsume
in class OMNodeImpl
javax.xml.stream.XMLStreamException
public void addChild(OMNode omNode)
OMElementImpl
addChild
in interface OMContainer
addChild
in class OMElementImpl
public Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
OMElementImpl
getChildrenWithName
in interface OMContainer
getChildrenWithName
in class OMElementImpl
elementQName
- The QName specifying namespace and local name to match.
OMElement
items that match the given QNamepublic Iterator getChildrenWithLocalName(String localName)
OMContainer
getChildrenWithLocalName
in interface OMContainer
getChildrenWithLocalName
in class OMElementImpl
OMElement
items that match the given localNamepublic Iterator getChildrenWithNamespaceURI(String uri)
OMContainer
getChildrenWithNamespaceURI
in interface OMContainer
getChildrenWithNamespaceURI
in class OMElementImpl
OMElement
items that match the given uripublic OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName) throws OMException
OMElementImpl
getFirstChildWithName
in interface OMContainer
getFirstChildWithName
in class OMElementImpl
elementQName
- The QName to use for matching.
OMException
- Could indirectly trigger building of child nodes.OMContainer.getChildrenWithName(javax.xml.namespace.QName)
public Iterator getChildren()
OMElementImpl
getChildren
in interface OMContainer
getChildren
in class OMElementImpl
OMContainer.getFirstChildWithName(javax.xml.namespace.QName)
,
OMContainer.getChildrenWithName(javax.xml.namespace.QName)
public OMNode getFirstOMChild()
OMElementImpl
getFirstOMChild
in interface OMContainer
getFirstOMChild
in class OMElementImpl
public void buildNext()
OMElementImpl
buildNext
in interface OMContainer
buildNext
in class OMElementImpl
public OMNode detach() throws OMException
OMElementImpl
detach
in interface OMNode
detach
in class OMElementImpl
OMException
- If a node is not complete, the detach can trigger further parsing, which may
cause an exception.public OMNode getNextOMSibling() throws OMException
OMElementImpl
getNextOMSibling
in interface OMNode
getNextOMSibling
in class OMElementImpl
OMException
public String getTrimmedText()
OMElementImpl
getTrimmedText
in class OMElementImpl
public boolean isComplete()
OMElementImpl
isComplete
in interface OMContainer
isComplete
in interface OMNode
isComplete
in class OMElementImpl
public String toString()
OMElement
toString
in interface OMElement
toString
in class OMElementImpl
public void buildWithAttachments()
OMNodeImpl
buildWithAttachments
in interface OMNode
buildWithAttachments
in class OMElementImpl
public void build() throws OMException
OMNodeImpl
build
in interface OMNode
build
in class OMElementImpl
OMException
protected void notifyChildComplete()
OMElementImpl
notifyChildComplete
in class OMElementImpl
public OMDataSource getDataSource()
getDataSource
in interface OMSourcedElement
public OMDataSource setDataSource(OMDataSource dataSource)
setDataSource
in interface OMSourcedElement
dataSource
- new OMDataSource
public void setComplete(boolean value)
setComplete
in interface OMContainerEx
setComplete
in interface OMNodeEx
setComplete
in class OMNodeImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |