org.apache.axis2.om
Interface OMElement

All Superinterfaces:
OMContainer, OMNode
All Known Subinterfaces:
SOAPBody, SOAPEnvelope, SOAPFault, SOAPFaultCode, SOAPFaultDetail, SOAPFaultNode, SOAPFaultReason, SOAPFaultRole, SOAPFaultSubCode, SOAPFaultText, SOAPFaultValue, SOAPHeader, SOAPHeaderBlock
All Known Implementing Classes:
OMElementImpl, SOAPBodyImpl, SOAPEnvelopeImpl, SOAPFaultCodeImpl, SOAPFaultDetailImpl, SOAPFaultImpl, SOAPFaultNodeImpl, SOAPFaultReasonImpl, SOAPFaultRoleImpl, SOAPFaultSubCodeImpl, SOAPFaultTextImpl, SOAPFaultValueImpl, SOAPHeaderBlockImpl, SOAPHeaderImpl

public interface OMElement
extends OMNode, OMContainer

Interface OMElement


Field Summary
 
Fields inherited from interface org.apache.axis2.om.OMNode
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE
 
Method Summary
 OMAttribute addAttribute(OMAttribute attr)
          This will insert attribute to this element.
 OMAttribute addAttribute(java.lang.String attributeName, java.lang.String value, OMNamespace ns)
           
 void addChild(OMNode omNode)
          This will add child to the element.
 OMNamespace declareNamespace(OMNamespace namespace)
           
 OMNamespace declareNamespace(java.lang.String uri, java.lang.String prefix)
          THis will create a namespace in the current element scope
 OMNamespace findNamespace(java.lang.String uri, java.lang.String prefix)
          This will find a namespace with the given uri and prefix, in the scope of the hierarchy.
 java.util.Iterator getAllDeclaredNamespaces()
           
 OMAttribute getAttribute(javax.xml.namespace.QName qname)
          Return a named attribute if present
 java.util.Iterator getAttributes()
          This will return a List of OMAttributes
 OMXMLParserWrapper getBuilder()
          Method getBuilder
 java.util.Iterator getChildElements()
          Returns a filtered list of children - just the elements.
 java.util.Iterator getChildren()
          This returns a collection of this element.
 java.util.Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
          This will search for children with a given QName and will return an iterator to traverse through the OMNodes.
 OMAttribute getFirstAttribute(javax.xml.namespace.QName qname)
          This will help to search for an attribute with a given QName within this Element
 OMNode getFirstChild()
          Get the first child
 OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName)
          This will return the first matched child, return null if none found
 OMElement getFirstElement()
          Convenience extension of the getFirstChild
 java.lang.String getLocalName()
          Method getLocalName
 OMNamespace getNamespace()
           
 javax.xml.namespace.QName getQName()
          Get the Qname of this node
 java.lang.String getText()
          This will return the non-empty text children as a String
 XMLStreamReader getXMLStreamReader()
          Returns the pull parser that will generate the pull events relevant to THIS element.
 XMLStreamReader getXMLStreamReaderWithoutCaching()
          Returns the pull parser that will generate the pull events relevant to THIS element.caching is off
 void removeAttribute(OMAttribute attr)
          Method removeAttribute
 void setBuilder(OMXMLParserWrapper wrapper)
          Method setBuilder
 void setFirstChild(OMNode node)
          Set the first child
 void setLocalName(java.lang.String localName)
          Method setLocalName
 void setNamespace(OMNamespace namespace)
          sets the Namespace
 void setText(java.lang.String text)
           
 
Methods inherited from interface org.apache.axis2.om.OMNode
build, detach, discard, getNextSibling, getParent, getPreviousSibling, getType, insertSiblingAfter, insertSiblingBefore, isComplete, serialize, serializeWithCache
 
Methods inherited from interface org.apache.axis2.om.OMContainer
buildNext, isComplete
 

Method Detail

addChild

public void addChild(OMNode omNode)
This will add child to the element. One must preserve the order of children, in this operation Tip : appending the new child is prefered

Specified by:
addChild in interface OMContainer
Parameters:
omNode -

getChildrenWithName

public java.util.Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
                                       throws OMException
This will search for children with a given QName and will return an iterator to traverse through the OMNodes. This will match localName and namespaceURI only. localName only or namespaceURI only can also be given. But the other parameter should be set to null Example : If you want to get all the addressing headers, header.getChildrenWithName(new QName(AddressingNamespace, null)) will do.

Specified by:
getChildrenWithName in interface OMContainer
Parameters:
elementQName -
Returns:
Throws:
OMException

getFirstChildWithName

public OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName)
                                throws OMException
This will return the first matched child, return null if none found

Specified by:
getFirstChildWithName in interface OMContainer
Parameters:
elementQName -
Returns:
Throws:
OMException

getChildren

public java.util.Iterator getChildren()
This returns a collection of this element. Children can be of types OMElement, OMText.

Specified by:
getChildren in interface OMContainer
Returns:

getChildElements

public java.util.Iterator getChildElements()
Returns a filtered list of children - just the elements.

Returns:
an iterator over the child elements

declareNamespace

public OMNamespace declareNamespace(java.lang.String uri,
                                    java.lang.String prefix)
THis will create a namespace in the current element scope

Parameters:
uri -
prefix -
Returns:

declareNamespace

public OMNamespace declareNamespace(OMNamespace namespace)
Parameters:
namespace -
Returns:

findNamespace

public OMNamespace findNamespace(java.lang.String uri,
                                 java.lang.String prefix)
                          throws OMException
This will find a namespace with the given uri and prefix, in the scope of the hierarchy. This will start to find from the current element and goes up in the hiararchy until this finds one. If none is found, return null

Parameters:
uri -
prefix -
Returns:
Throws:
OMException

getAllDeclaredNamespaces

public java.util.Iterator getAllDeclaredNamespaces()
                                            throws OMException
Returns:
Throws:
OMException

getFirstAttribute

public OMAttribute getFirstAttribute(javax.xml.namespace.QName qname)
                              throws OMException
This will help to search for an attribute with a given QName within this Element

Parameters:
qname -
Returns:
Throws:
OMException

getAttributes

public java.util.Iterator getAttributes()
This will return a List of OMAttributes

Returns:

getAttribute

public OMAttribute getAttribute(javax.xml.namespace.QName qname)
Return a named attribute if present

Parameters:
qname - the qualified name to search for
Returns:
an OMAttribute with the given name if found, or null

addAttribute

public OMAttribute addAttribute(OMAttribute attr)
This will insert attribute to this element. Implementor can decide as to insert this in the front or at the end of set of attributes

Parameters:
attr -
Returns:

addAttribute

public OMAttribute addAttribute(java.lang.String attributeName,
                                java.lang.String value,
                                OMNamespace ns)
Parameters:
attributeName -
value -
ns - - the namespace has to be one of the in scope namespace. i.e. the passed namespace must be declared in the parent element of this attribute or ancestors of the parent element of the attribute
Returns:

removeAttribute

public void removeAttribute(OMAttribute attr)
Method removeAttribute

Parameters:
attr -

setBuilder

public void setBuilder(OMXMLParserWrapper wrapper)
Method setBuilder

Parameters:
wrapper -

getBuilder

public OMXMLParserWrapper getBuilder()
Method getBuilder

Returns:

setFirstChild

public void setFirstChild(OMNode node)
Set the first child

Parameters:
node -

getFirstChild

public OMNode getFirstChild()
Get the first child

Specified by:
getFirstChild in interface OMContainer
Returns:

getFirstElement

public OMElement getFirstElement()
Convenience extension of the getFirstChild

Returns:

getXMLStreamReader

public XMLStreamReader getXMLStreamReader()
Returns the pull parser that will generate the pull events relevant to THIS element. Caching is on

Returns:

getXMLStreamReaderWithoutCaching

public XMLStreamReader getXMLStreamReaderWithoutCaching()
Returns the pull parser that will generate the pull events relevant to THIS element.caching is off

Returns:

setText

public void setText(java.lang.String text)
Parameters:
text -

getText

public java.lang.String getText()
This will return the non-empty text children as a String

Returns:

getLocalName

public java.lang.String getLocalName()
Method getLocalName

Returns:

setLocalName

public void setLocalName(java.lang.String localName)
Method setLocalName

Parameters:
localName -

getNamespace

public OMNamespace getNamespace()
                         throws OMException
Returns:
the OMNamespace object associated with this element
Throws:
OMException

setNamespace

public void setNamespace(OMNamespace namespace)
sets the Namespace

Parameters:
namespace -

getQName

public javax.xml.namespace.QName getQName()
Get the Qname of this node

Returns: