org.apache.axiom.om.impl.llom
Class OMSourcedElementImpl

java.lang.Object
  extended by org.apache.axiom.om.impl.llom.OMNodeImpl
      extended by org.apache.axiom.om.impl.llom.OMElementImpl
          extended by org.apache.axiom.om.impl.llom.OMSourcedElementImpl
All Implemented Interfaces:
org.apache.axiom.om.impl.OMContainerEx, org.apache.axiom.om.impl.OMNodeEx, org.apache.axiom.om.OMConstants, org.apache.axiom.om.OMContainer, org.apache.axiom.om.OMElement, org.apache.axiom.om.OMNode, org.apache.axiom.om.OMSourcedElement
Direct Known Subclasses:
SOAPHeaderBlockImpl

public class OMSourcedElementImpl
extends OMElementImpl
implements org.apache.axiom.om.OMSourcedElement

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
private  org.apache.axiom.om.OMDataSource dataSource
          Data source for element data.
private  org.apache.axiom.om.OMNamespace definedNamespace
          Namespace for element, needed in order to bypass base class handling.
private static boolean isDebugEnabled
           
private  boolean isExpanded
          Flag for parser provided to base element class.
private static org.apache.commons.logging.Log log
           
private  javax.xml.stream.XMLStreamReader readerFromDS
           
 
Fields inherited from class org.apache.axiom.om.impl.llom.OMElementImpl
attributes, DEFAULT_DEFAULT_NS_OBJECT, firstChild, lastChild, localName, namespaces, noPrefixNamespaceCounter, ns, xmlns
 
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
 
Fields inherited from interface org.apache.axiom.om.OMConstants
ARRAY_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, XMLNS_NS_PREFIX, XMLNS_NS_URI, XMLNS_PREFIX, XMLNS_URI
 
Constructor Summary
OMSourcedElementImpl(javax.xml.namespace.QName qName, org.apache.axiom.om.OMFactory factory, org.apache.axiom.om.OMDataSource source)
          Constructor that takes a QName instead of the local name and the namespace seperately
OMSourcedElementImpl(java.lang.String localName, org.apache.axiom.om.OMNamespace ns, org.apache.axiom.om.OMContainer parent, org.apache.axiom.om.OMFactory factory)
           
OMSourcedElementImpl(java.lang.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)
           
OMSourcedElementImpl(java.lang.String localName, org.apache.axiom.om.OMNamespace ns, org.apache.axiom.om.OMFactory factory)
           
OMSourcedElementImpl(java.lang.String localName, org.apache.axiom.om.OMNamespace ns, org.apache.axiom.om.OMFactory factory, org.apache.axiom.om.OMDataSource source)
          Constructor.
 
Method Summary
 org.apache.axiom.om.OMAttribute addAttribute(org.apache.axiom.om.OMAttribute attr)
          Inserts an attribute to this element.
 org.apache.axiom.om.OMAttribute addAttribute(java.lang.String attributeName, java.lang.String value, org.apache.axiom.om.OMNamespace namespace)
          Creates an OMAttributeImpl instance out of the given arguments and inserts that attribute to this element.
 void addChild(org.apache.axiom.om.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.
 org.apache.axiom.om.OMElement cloneOMElement()
           
 org.apache.axiom.om.OMNamespace declareDefaultNamespace(java.lang.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(java.lang.String uri, java.lang.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(java.lang.String uri, java.lang.String prefix)
          Finds a namespace with the given uri and prefix, in the scope of the document.
 org.apache.axiom.om.OMNamespace findNamespaceURI(java.lang.String prefix)
           
private  void forceExpand()
          Set parser for OM, if not previously set.
 java.util.Iterator getAllAttributes()
          Returns a List of OMAttributes.
 java.util.Iterator getAllDeclaredNamespaces()
          Method getAllDeclaredNamespaces.
 org.apache.axiom.om.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.
 org.apache.axiom.om.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)
           
 org.apache.axiom.om.OMDataSource getDataSource()
          Provide access to the data source encapsulated in OMSourcedElement.
 org.apache.axiom.om.OMNamespace getDefaultNamespace()
           
private  javax.xml.stream.XMLStreamReader getDirectReader()
          Get parser from data source.
 org.apache.axiom.om.OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName)
          Method getFirstChildWithName.
 org.apache.axiom.om.OMElement getFirstElement()
          Gets first element.
 org.apache.axiom.om.OMNode getFirstOMChild()
          Method getFirstOMChild.
 int getLineNumber()
           
 java.lang.String getLocalName()
          Method getLocalName.
 org.apache.axiom.om.OMNamespace getNamespace()
          Method getNamespace.
 org.apache.axiom.om.OMNode getNextOMSibling()
          Gets the next sibling.
private  java.lang.String getPrintableName()
          Generate element name for output.
 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()
          Method getXMLStreamReader.
 javax.xml.stream.XMLStreamReader getXMLStreamReaderWithoutCaching()
          Method getXMLStreamReaderWithoutCaching.
(package private)  org.apache.axiom.om.OMNamespace handleNamespace(javax.xml.namespace.QName qname)
          Method handleNamespace.
(package private)  org.apache.axiom.om.OMNamespace handleNamespace(java.lang.String namespaceURI, java.lang.String prefix)
           
 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.
private  boolean isDestructiveRead()
           
private  boolean isDestructiveWrite()
           
 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(org.apache.axiom.om.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 serialize(java.io.OutputStream output)
           
 void serialize(java.io.OutputStream output, org.apache.axiom.om.OMOutputFormat format)
           
 void serialize(java.io.Writer writer)
           
 void serialize(java.io.Writer writer, org.apache.axiom.om.OMOutputFormat format)
           
 void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes the node with caching.
 void serializeAndConsume(java.io.OutputStream output)
           
 void serializeAndConsume(java.io.OutputStream output, org.apache.axiom.om.OMOutputFormat format)
           
 void serializeAndConsume(java.io.Writer writer)
           
 void serializeAndConsume(java.io.Writer writer, org.apache.axiom.om.OMOutputFormat format)
           
 void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes the node without caching.
 void setBuilder(org.apache.axiom.om.OMXMLParserWrapper wrapper)
          Method setBuilder.
 void setComplete(boolean value)
          setComplete override The OMSourcedElement has its own isolated builder/reader during the expansion process.
 org.apache.axiom.om.OMDataSource setDataSource(org.apache.axiom.om.OMDataSource dataSource)
          setOMDataSource
 void setFirstChild(org.apache.axiom.om.OMNode node)
          Method setFirstChild.
 void setLastChild(org.apache.axiom.om.OMNode omNode)
           
 void setLineNumber(int lineNumber)
           
 void setLocalName(java.lang.String localName)
          Method setLocalName.
 void setNamespace(org.apache.axiom.om.OMNamespace namespace)
          Method setNamespace.
 void setNamespaceWithNoFindInCurrentScope(org.apache.axiom.om.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()
           
 
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
 

Field Detail

dataSource

private org.apache.axiom.om.OMDataSource dataSource
Data source for element data.


definedNamespace

private org.apache.axiom.om.OMNamespace definedNamespace
Namespace for element, needed in order to bypass base class handling.


isExpanded

private boolean isExpanded
Flag for parser provided to base element class.


log

private static org.apache.commons.logging.Log log

isDebugEnabled

private static final boolean isDebugEnabled

readerFromDS

private javax.xml.stream.XMLStreamReader readerFromDS
Constructor Detail

OMSourcedElementImpl

public OMSourcedElementImpl(java.lang.String localName,
                            org.apache.axiom.om.OMNamespace ns,
                            org.apache.axiom.om.OMFactory factory,
                            org.apache.axiom.om.OMDataSource source)
Constructor.

Parameters:
localName -
ns -
factory -
source -

OMSourcedElementImpl

public OMSourcedElementImpl(javax.xml.namespace.QName qName,
                            org.apache.axiom.om.OMFactory factory,
                            org.apache.axiom.om.OMDataSource source)
Constructor that takes a QName instead of the local name and the namespace seperately

Parameters:
qName -
factory -
source -

OMSourcedElementImpl

public OMSourcedElementImpl(java.lang.String localName,
                            org.apache.axiom.om.OMNamespace ns,
                            org.apache.axiom.om.OMContainer parent,
                            org.apache.axiom.om.OMFactory factory)

OMSourcedElementImpl

public OMSourcedElementImpl(java.lang.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)

OMSourcedElementImpl

public OMSourcedElementImpl(java.lang.String localName,
                            org.apache.axiom.om.OMNamespace ns,
                            org.apache.axiom.om.OMFactory factory)
Method Detail

getPrintableName

private java.lang.String getPrintableName()
Generate element name for output.

Returns:
name

getDirectReader

private javax.xml.stream.XMLStreamReader getDirectReader()
Get parser from data source. Note that getDataReader may consume the underlying data source.

Returns:
parser

forceExpand

private void forceExpand()
Set parser for OM, if not previously set. Since the builder is what actually constructs the tree on demand, this first creates a builder


isExpanded

public boolean isExpanded()
Check if element has been expanded into tree.

Specified by:
isExpanded in interface org.apache.axiom.om.OMSourcedElement
Returns:
true if expanded, false if not

getChildElements

public java.util.Iterator getChildElements()
Description copied from class: OMElementImpl
Returns a filtered list of children - just the elements.

Specified by:
getChildElements in interface org.apache.axiom.om.OMElement
Overrides:
getChildElements in class OMElementImpl
Returns:
Returns an iterator of the child elements.

declareNamespace

public org.apache.axiom.om.OMNamespace declareNamespace(java.lang.String uri,
                                                        java.lang.String prefix)
Description copied from class: OMElementImpl
Creates a namespace in the current element scope.

Specified by:
declareNamespace in interface org.apache.axiom.om.OMElement
Overrides:
declareNamespace in class OMElementImpl
Returns:
Returns namespace.

declareDefaultNamespace

public org.apache.axiom.om.OMNamespace declareDefaultNamespace(java.lang.String uri)
Description copied from class: OMElementImpl
We use "" to store the default namespace of this element. As one can see user can not give "" as the prefix, when he declare a usual namespace.

Specified by:
declareDefaultNamespace in interface org.apache.axiom.om.OMElement
Overrides:
declareDefaultNamespace in class OMElementImpl

getDefaultNamespace

public org.apache.axiom.om.OMNamespace getDefaultNamespace()
Specified by:
getDefaultNamespace in interface org.apache.axiom.om.OMElement
Overrides:
getDefaultNamespace in class OMElementImpl

declareNamespace

public org.apache.axiom.om.OMNamespace declareNamespace(org.apache.axiom.om.OMNamespace namespace)
Specified by:
declareNamespace in interface org.apache.axiom.om.OMElement
Overrides:
declareNamespace in class OMElementImpl
Returns:
Returns namespace.

findNamespace

public org.apache.axiom.om.OMNamespace findNamespace(java.lang.String uri,
                                                     java.lang.String prefix)
Description copied from class: OMElementImpl
Finds a namespace with the given uri and prefix, in the scope of the document. Starts to find from the current element and goes up in the hiararchy until one is found. If none is found, returns null.

Specified by:
findNamespace in interface org.apache.axiom.om.OMElement
Overrides:
findNamespace in class OMElementImpl

findNamespaceURI

public org.apache.axiom.om.OMNamespace findNamespaceURI(java.lang.String prefix)
Specified by:
findNamespaceURI in interface org.apache.axiom.om.OMElement
Overrides:
findNamespaceURI in class OMElementImpl

getAllDeclaredNamespaces

public java.util.Iterator getAllDeclaredNamespaces()
                                            throws org.apache.axiom.om.OMException
Description copied from class: OMElementImpl
Method getAllDeclaredNamespaces.

Specified by:
getAllDeclaredNamespaces in interface org.apache.axiom.om.OMElement
Overrides:
getAllDeclaredNamespaces in class OMElementImpl
Returns:
Returns Iterator.
Throws:
org.apache.axiom.om.OMException

getAllAttributes

public java.util.Iterator getAllAttributes()
Description copied from class: OMElementImpl
Returns a List of OMAttributes.

Specified by:
getAllAttributes in interface org.apache.axiom.om.OMElement
Overrides:
getAllAttributes in class OMElementImpl
Returns:
Returns iterator.

getAttribute

public org.apache.axiom.om.OMAttribute getAttribute(javax.xml.namespace.QName qname)
Description copied from class: OMElementImpl
Returns a named attribute if present.

Specified by:
getAttribute in interface org.apache.axiom.om.OMElement
Overrides:
getAttribute in class OMElementImpl
Parameters:
qname - the qualified name to search for
Returns:
Returns an OMAttribute with the given name if found, or null

getAttributeValue

public java.lang.String getAttributeValue(javax.xml.namespace.QName qname)
Description copied from class: OMElementImpl
Returns a named attribute's value, if present.

Specified by:
getAttributeValue in interface org.apache.axiom.om.OMElement
Overrides:
getAttributeValue in class OMElementImpl
Parameters:
qname - the qualified name to search for
Returns:
Returns a String containing the attribute value, or null.

addAttribute

public org.apache.axiom.om.OMAttribute addAttribute(org.apache.axiom.om.OMAttribute attr)
Description copied from class: OMElementImpl
Inserts an 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.

Specified by:
addAttribute in interface org.apache.axiom.om.OMElement
Overrides:
addAttribute in class OMElementImpl
Returns:
The attribute that was added to the element. Note: The added attribute may not be the same instance that was given to add. This can happen if the given attribute already has an owner. In such case the returned attribute and the given attribute are equal but not the same instance.
See Also:
OMAttributeImpl.equals(Object)

addAttribute

public org.apache.axiom.om.OMAttribute addAttribute(java.lang.String attributeName,
                                                    java.lang.String value,
                                                    org.apache.axiom.om.OMNamespace namespace)
Description copied from class: OMElementImpl
Creates an 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.

Specified by:
addAttribute in interface org.apache.axiom.om.OMElement
Overrides:
addAttribute in class OMElementImpl
Parameters:
attributeName - The name of the attribute
value - The value of the attribute
namespace - The namespace of the attribute
Returns:
The attribute that was added to the element. Note: The added attribute may not be the same instance that was given to add. This can happen if the given attribute already has an owner. In such case the returned attribute and the given attribute are equal but not the same instance.
See Also:
OMAttributeImpl.equals(Object)

removeAttribute

public void removeAttribute(org.apache.axiom.om.OMAttribute attr)
Description copied from class: OMElementImpl
Method removeAttribute.

Specified by:
removeAttribute in interface org.apache.axiom.om.OMElement
Overrides:
removeAttribute in class OMElementImpl

setBuilder

public void setBuilder(org.apache.axiom.om.OMXMLParserWrapper wrapper)
Description copied from class: OMElementImpl
Method setBuilder.

Specified by:
setBuilder in interface org.apache.axiom.om.OMElement
Overrides:
setBuilder in class OMElementImpl

getBuilder

public org.apache.axiom.om.OMXMLParserWrapper getBuilder()
Description copied from class: OMElementImpl
Method getBuilder.

Specified by:
getBuilder in interface org.apache.axiom.om.OMElement
Overrides:
getBuilder in class OMElementImpl
Returns:
Returns OMXMLParserWrapper.

setFirstChild

public void setFirstChild(org.apache.axiom.om.OMNode node)
Description copied from class: OMElementImpl
Method setFirstChild.

Specified by:
setFirstChild in interface org.apache.axiom.om.impl.OMContainerEx
Specified by:
setFirstChild in interface org.apache.axiom.om.OMElement
Overrides:
setFirstChild in class OMElementImpl

setLastChild

public void setLastChild(org.apache.axiom.om.OMNode omNode)
Specified by:
setLastChild in interface org.apache.axiom.om.impl.OMContainerEx
Overrides:
setLastChild in class OMElementImpl

getFirstElement

public org.apache.axiom.om.OMElement getFirstElement()
Description copied from class: OMElementImpl
Gets first element.

Specified by:
getFirstElement in interface org.apache.axiom.om.OMElement
Overrides:
getFirstElement in class OMElementImpl
Returns:
Returns element.

getXMLStreamReader

public javax.xml.stream.XMLStreamReader getXMLStreamReader()
Description copied from class: OMElementImpl
Method getXMLStreamReader.

Specified by:
getXMLStreamReader in interface org.apache.axiom.om.OMElement
Overrides:
getXMLStreamReader in class OMElementImpl
See Also:
OMElement.getXMLStreamReader()

getXMLStreamReaderWithoutCaching

public javax.xml.stream.XMLStreamReader getXMLStreamReaderWithoutCaching()
Description copied from class: OMElementImpl
Method getXMLStreamReaderWithoutCaching.

Specified by:
getXMLStreamReaderWithoutCaching in interface org.apache.axiom.om.OMElement
Overrides:
getXMLStreamReaderWithoutCaching in class OMElementImpl
See Also:
OMElement.getXMLStreamReaderWithoutCaching()

setText

public void setText(java.lang.String text)
Description copied from class: OMElementImpl
Sets the text of the given element. caution - This method will wipe out all the text elements (and hence any mixed content) before setting the text.

Specified by:
setText in interface org.apache.axiom.om.OMElement
Overrides:
setText in class OMElementImpl

setText

public void setText(javax.xml.namespace.QName text)
Description copied from class: OMElementImpl
Sets the text, as a QName, of the given element. caution - This method will wipe out all the text elements (and hence any mixed content) before setting the text.

Specified by:
setText in interface org.apache.axiom.om.OMElement
Overrides:
setText in class OMElementImpl

getText

public java.lang.String getText()
Description copied from class: OMElementImpl
Selects all the text children and concatenates them to a single string.

Specified by:
getText in interface org.apache.axiom.om.OMElement
Overrides:
getText in class OMElementImpl
Returns:
Returns String.

getTextAsQName

public javax.xml.namespace.QName getTextAsQName()
Specified by:
getTextAsQName in interface org.apache.axiom.om.OMElement
Overrides:
getTextAsQName in class OMElementImpl

getLocalName

public java.lang.String getLocalName()
Description copied from class: OMElementImpl
Method getLocalName.

Specified by:
getLocalName in interface org.apache.axiom.om.OMElement
Overrides:
getLocalName in class OMElementImpl
Returns:
Returns local name.

setLocalName

public void setLocalName(java.lang.String localName)
Description copied from class: OMElementImpl
Method setLocalName.

Specified by:
setLocalName in interface org.apache.axiom.om.OMElement
Overrides:
setLocalName in class OMElementImpl

getNamespace

public org.apache.axiom.om.OMNamespace getNamespace()
                                             throws org.apache.axiom.om.OMException
Description copied from class: OMElementImpl
Method getNamespace.

Specified by:
getNamespace in interface org.apache.axiom.om.OMElement
Overrides:
getNamespace in class OMElementImpl
Throws:
org.apache.axiom.om.OMException

setNamespace

public void setNamespace(org.apache.axiom.om.OMNamespace namespace)
Description copied from class: OMElementImpl
Method setNamespace.

Specified by:
setNamespace in interface org.apache.axiom.om.OMElement
Overrides:
setNamespace in class OMElementImpl

setNamespaceWithNoFindInCurrentScope

public void setNamespaceWithNoFindInCurrentScope(org.apache.axiom.om.OMNamespace namespace)
Specified by:
setNamespaceWithNoFindInCurrentScope in interface org.apache.axiom.om.OMElement
Overrides:
setNamespaceWithNoFindInCurrentScope in class OMElementImpl

getQName

public javax.xml.namespace.QName getQName()
Description copied from class: OMElementImpl
Method getQName.

Specified by:
getQName in interface org.apache.axiom.om.OMElement
Overrides:
getQName in class OMElementImpl
Returns:
Returns QName.

toStringWithConsume

public java.lang.String toStringWithConsume()
                                     throws javax.xml.stream.XMLStreamException
Specified by:
toStringWithConsume in interface org.apache.axiom.om.OMElement
Overrides:
toStringWithConsume in class OMElementImpl
Throws:
javax.xml.stream.XMLStreamException

isDestructiveWrite

private boolean isDestructiveWrite()

isDestructiveRead

private boolean isDestructiveRead()

resolveQName

public javax.xml.namespace.QName resolveQName(java.lang.String qname)
Description copied from class: OMElementImpl
Converts a prefix:local qname string into a proper QName, evaluating it in the OMElement context. Unprefixed qnames resolve to the local namespace.

Specified by:
resolveQName in interface org.apache.axiom.om.OMElement
Overrides:
resolveQName in class OMElementImpl
Parameters:
qname - prefixed qname string to resolve
Returns:
Returns null for any failure to extract a qname.

cloneOMElement

public org.apache.axiom.om.OMElement cloneOMElement()
Specified by:
cloneOMElement in interface org.apache.axiom.om.OMElement
Overrides:
cloneOMElement in class OMElementImpl

setLineNumber

public void setLineNumber(int lineNumber)
Specified by:
setLineNumber in interface org.apache.axiom.om.OMElement
Overrides:
setLineNumber in class OMElementImpl

getLineNumber

public int getLineNumber()
Specified by:
getLineNumber in interface org.apache.axiom.om.OMElement
Overrides:
getLineNumber in class OMElementImpl

discard

public void discard()
             throws org.apache.axiom.om.OMException
Description copied from class: OMElementImpl
Method discard.

Specified by:
discard in interface org.apache.axiom.om.OMNode
Overrides:
discard in class OMElementImpl
Throws:
org.apache.axiom.om.OMException

getType

public int getType()
Description copied from class: OMElementImpl
Gets the type of node, as this is the super class of all the nodes.

Specified by:
getType in interface org.apache.axiom.om.OMNode
Overrides:
getType in class OMElementImpl
Returns:
Returns the type of node as indicated by OMNodeImpl.setType(int)
See Also:
OMNodeImpl.setType(int)

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
                       throws javax.xml.stream.XMLStreamException
Description copied from class: OMElementImpl
Method internalSerialize.

Specified by:
internalSerialize in interface org.apache.axiom.om.impl.OMNodeEx
Overrides:
internalSerialize in class OMElementImpl
Throws:
javax.xml.stream.XMLStreamException

internalSerialize

protected void internalSerialize(javax.xml.stream.XMLStreamWriter writer,
                                 boolean cache)
                          throws javax.xml.stream.XMLStreamException
Overrides:
internalSerialize in class OMElementImpl
Throws:
javax.xml.stream.XMLStreamException

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
                                 throws javax.xml.stream.XMLStreamException
Description copied from class: OMElementImpl
This method serializes and consumes without building the object structure in memory. Misuse of this method will cause loss of data. So it is advised to use populateYourSelf() method, before calling this method, if one wants to preserve data in the stream. This was requested during the second Axis2 summit.

Specified by:
internalSerializeAndConsume in interface org.apache.axiom.om.impl.OMNodeEx
Overrides:
internalSerializeAndConsume in class OMElementImpl
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
               throws javax.xml.stream.XMLStreamException
Description copied from class: OMNodeImpl
Serializes the node with caching.

Specified by:
serialize in interface org.apache.axiom.om.OMNode
Overrides:
serialize in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.OutputStream output)
               throws javax.xml.stream.XMLStreamException
Specified by:
serialize in interface org.apache.axiom.om.OMNode
Overrides:
serialize in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.Writer writer)
               throws javax.xml.stream.XMLStreamException
Specified by:
serialize in interface org.apache.axiom.om.OMNode
Overrides:
serialize in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.OutputStream output,
                      org.apache.axiom.om.OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Specified by:
serialize in interface org.apache.axiom.om.OMNode
Overrides:
serialize in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.Writer writer,
                      org.apache.axiom.om.OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Specified by:
serialize in interface org.apache.axiom.om.OMNode
Overrides:
serialize in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
                         throws javax.xml.stream.XMLStreamException
Description copied from class: OMNodeImpl
Serializes the node without caching.

Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Overrides:
serializeAndConsume in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.OutputStream output)
                         throws javax.xml.stream.XMLStreamException
Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Overrides:
serializeAndConsume in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.Writer writer)
                         throws javax.xml.stream.XMLStreamException
Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Overrides:
serializeAndConsume in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.OutputStream output,
                                org.apache.axiom.om.OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Overrides:
serializeAndConsume in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.Writer writer,
                                org.apache.axiom.om.OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Overrides:
serializeAndConsume in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

addChild

public void addChild(org.apache.axiom.om.OMNode omNode)
Description copied from class: OMElementImpl
Adds child to the element. One can decide whether to append the child or to add to the front of the children list.

Specified by:
addChild in interface org.apache.axiom.om.OMContainer
Overrides:
addChild in class OMElementImpl

getChildrenWithName

public java.util.Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
Description copied from class: OMElementImpl
Searches for children with a given QName and returns an iterator to traverse through the OMNodes. This QName can contain any combination of prefix, localname and URI.

Specified by:
getChildrenWithName in interface org.apache.axiom.om.OMContainer
Overrides:
getChildrenWithName in class OMElementImpl

getChildrenWithLocalName

public java.util.Iterator getChildrenWithLocalName(java.lang.String localName)
Specified by:
getChildrenWithLocalName in interface org.apache.axiom.om.OMContainer
Overrides:
getChildrenWithLocalName in class OMElementImpl

getChildrenWithNamespaceURI

public java.util.Iterator getChildrenWithNamespaceURI(java.lang.String uri)
Specified by:
getChildrenWithNamespaceURI in interface org.apache.axiom.om.OMContainer
Overrides:
getChildrenWithNamespaceURI in class OMElementImpl

getFirstChildWithName

public org.apache.axiom.om.OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName)
                                                    throws org.apache.axiom.om.OMException
Description copied from class: OMElementImpl
Method getFirstChildWithName.

Specified by:
getFirstChildWithName in interface org.apache.axiom.om.OMContainer
Overrides:
getFirstChildWithName in class OMElementImpl
Throws:
org.apache.axiom.om.OMException

getChildren

public java.util.Iterator getChildren()
Description copied from class: OMElementImpl
Returns a collection of this element. Children can be of types OMElement, OMText.

Specified by:
getChildren in interface org.apache.axiom.om.OMContainer
Overrides:
getChildren in class OMElementImpl
Returns:
Returns children.

getFirstOMChild

public org.apache.axiom.om.OMNode getFirstOMChild()
Description copied from class: OMElementImpl
Method getFirstOMChild.

Specified by:
getFirstOMChild in interface org.apache.axiom.om.OMContainer
Overrides:
getFirstOMChild in class OMElementImpl
Returns:
Returns child.

buildNext

public void buildNext()
Description copied from class: OMElementImpl
Forces the parser to proceed, if parser has not yet finished with the XML input.

Specified by:
buildNext in interface org.apache.axiom.om.OMContainer
Overrides:
buildNext in class OMElementImpl

detach

public org.apache.axiom.om.OMNode detach()
                                  throws org.apache.axiom.om.OMException
Description copied from class: OMElementImpl
Removes this information item and its children, from the model completely.

Specified by:
detach in interface org.apache.axiom.om.OMNode
Overrides:
detach in class OMElementImpl
Throws:
org.apache.axiom.om.OMException

getNextOMSibling

public org.apache.axiom.om.OMNode getNextOMSibling()
                                            throws org.apache.axiom.om.OMException
Description copied from class: OMElementImpl
Gets the next sibling. This can be an OMAttribute or OMText or OMELement for others.

Specified by:
getNextOMSibling in interface org.apache.axiom.om.OMNode
Overrides:
getNextOMSibling in class OMElementImpl
Returns:
Returns OMNode.
Throws:
org.apache.axiom.om.OMException

getTrimmedText

public java.lang.String getTrimmedText()
Description copied from class: OMElementImpl
Returns the concatination string of TRIMMED values of all OMText child nodes of this element. This is included purely to improve usability.

Overrides:
getTrimmedText in class OMElementImpl

handleNamespace

org.apache.axiom.om.OMNamespace handleNamespace(javax.xml.namespace.QName qname)
Description copied from class: OMElementImpl
Method handleNamespace.

Overrides:
handleNamespace in class OMElementImpl

isComplete

public boolean isComplete()
Description copied from class: OMElementImpl
Method isComplete.

Specified by:
isComplete in interface org.apache.axiom.om.OMContainer
Specified by:
isComplete in interface org.apache.axiom.om.OMNode
Overrides:
isComplete in class OMElementImpl
Returns:
Returns boolean.

toString

public java.lang.String toString()
Specified by:
toString in interface org.apache.axiom.om.OMElement
Overrides:
toString in class OMElementImpl

buildWithAttachments

public void buildWithAttachments()
Description copied from class: OMNodeImpl
Parses this node and builds the object structure in memory. AXIOM supports two levels of deffered building. First is deffered building of AXIOM using StAX. Second level is the deffered building of attachments. AXIOM reads in the attachements from the stream only when user asks by calling getDataHandler(). build() method builds the OM without the attachments. buildAll() builds the OM together with attachement data. This becomes handy when user wants to free the input stream.

Specified by:
buildWithAttachments in interface org.apache.axiom.om.OMNode
Overrides:
buildWithAttachments in class OMElementImpl

build

public void build()
           throws org.apache.axiom.om.OMException
Description copied from class: OMNodeImpl
Parses this node and builds the object structure in memory. However a node, created programmatically, will have done set to true by default and this will cause populateyourself not to work properly!

Specified by:
build in interface org.apache.axiom.om.OMNode
Overrides:
build in class OMElementImpl
Throws:
org.apache.axiom.om.OMException

notifyChildComplete

protected void notifyChildComplete()
Description copied from class: OMElementImpl
This method will be called when one of the children becomes complete.

Overrides:
notifyChildComplete in class OMElementImpl

handleNamespace

org.apache.axiom.om.OMNamespace handleNamespace(java.lang.String namespaceURI,
                                                java.lang.String prefix)
Overrides:
handleNamespace in class OMElementImpl

getDataSource

public org.apache.axiom.om.OMDataSource getDataSource()
Provide access to the data source encapsulated in OMSourcedElement. This is usesful when we want to access the raw data in the data source.

Specified by:
getDataSource in interface org.apache.axiom.om.OMSourcedElement
Returns:
the internal datasource

setDataSource

public org.apache.axiom.om.OMDataSource setDataSource(org.apache.axiom.om.OMDataSource dataSource)
setOMDataSource

Specified by:
setDataSource in interface org.apache.axiom.om.OMSourcedElement

setComplete

public void setComplete(boolean value)
setComplete override The OMSourcedElement has its own isolated builder/reader during the expansion process. Thus calls to setCompete should stop here and not propogate up to the parent (which may have a different builder or no builder).

Specified by:
setComplete in interface org.apache.axiom.om.impl.OMContainerEx
Specified by:
setComplete in interface org.apache.axiom.om.impl.OMNodeEx
Overrides:
setComplete in class OMNodeImpl