org.apache.axis2.saaj
Class SOAPElementImpl

java.lang.Object
  extended by org.apache.axiom.om.impl.dom.NodeImpl
      extended by org.apache.axis2.saaj.NodeImplEx
          extended by org.apache.axis2.saaj.SOAPElementImpl
All Implemented Interfaces:
Cloneable, SOAPElement, Element, Node, NodeList
Direct Known Subclasses:
DetailEntryImpl, SOAPBodyElementImpl, SOAPBodyImpl, SOAPEnvelopeImpl, SOAPFaultElementImpl, SOAPHeaderElementImpl, SOAPHeaderImpl

public class SOAPElementImpl
extends NodeImplEx
implements SOAPElement


Field Summary
protected  org.apache.axiom.om.impl.dom.ElementImpl element
          Using a delegate because we can't extend from org.apache.axiom.om.impl.dom.ElementImpl since this class must extend SNodeImpl
 
Fields inherited from class org.apache.axis2.saaj.NodeImplEx
parentElement
 
Fields inherited from class org.apache.axiom.om.impl.dom.NodeImpl
builder, done, factory, FIRSTCHILD, flags, HAS_PARENT, SPECIFIED
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
SOAPElementImpl(org.apache.axiom.om.impl.dom.ElementImpl element)
           
 
Method Summary
 SOAPElement addAttribute(Name name, String value)
          Adds an attribute with the specified name and value to this SOAPElement object.
 SOAPElement addAttribute(QName qname, String value)
           
 SOAPElement addChildElement(Name name)
           
 SOAPElement addChildElement(QName qname)
           
 SOAPElement addChildElement(SOAPElement soapElement)
           
 SOAPElement addChildElement(String localName)
           
 SOAPElement addChildElement(String localName, String prefix)
           
 SOAPElement addChildElement(String localName, String prefix, String namespaceURI)
           
 SOAPElement addNamespaceDeclaration(String prefix, String uri)
           
 SOAPElement addTextNode(String text)
          Creates a new Text object initialized with the given String and adds it to this SOAPElement object.
 Node appendChild(Node child)
           
protected  Element appendElement(org.apache.axiom.om.impl.dom.ElementImpl child)
           
protected  Text appendText(Text child)
           
protected  Object clone()
           
protected  void copyContents(SOAPElementImpl childEle, Node child)
           
 QName createQName(String localName, String prefix)
          Creates a QName whose namespace URI is the one associated with the parameter, prefix, in the context of this SOAPElement.
 org.apache.axiom.om.OMNode detach()
           
 void detachNode()
          Removes this Node object from the tree.
 void discard()
           
 Iterator getAllAttributes()
          Returns an iterator over all of the attribute names in this SOAPElement object.
 Iterator getAllAttributesAsQNames()
           
 String getAttribute(String name)
           
 Attr getAttributeNode(String name)
           
 Attr getAttributeNodeNS(String namespaceURI, String localName)
           
 String getAttributeNS(String namespaceURI, String localName)
           
 NamedNodeMap getAttributes()
          Returns the collection of attributes associated with this node, or null if none.
 String getAttributeValue(Name name)
           
 String getAttributeValue(QName qname)
           
 Iterator getChildElements()
          Returns an iterator over all the immediate content of this element.
 Iterator getChildElements(Name name)
           
 Iterator getChildElements(QName qname)
           
 NodeList getChildNodes()
           
 org.apache.axiom.om.impl.dom.ElementImpl getElement()
           
 Name getElementName()
           
 QName getElementQName()
           
 NodeList getElementsByTagName(String name)
           
 NodeList getElementsByTagNameNS(String namespaceURI, String localName)
           
 String getEncodingStyle()
           
 Node getFirstChild()
           
 Node getLastChild()
          Method getLastChild
 String getLocalName()
           
 Iterator getNamespacePrefixes()
           
 String getNamespaceURI()
           
 String getNamespaceURI(String prefix)
           
 Node getNextSibling()
          dom Node method
 String getNodeName()
           
 short getNodeType()
           
 Document getOwnerDocument()
          Find the Document that this Node belongs to (the document in whose context the Node was created).
 SOAPElement getParentElement()
          Returns the parent element of this Node object.
 Node getParentNode()
           
 String getPrefix()
           
 Node getPreviousSibling()
           
 String getTagName()
           
 String getTextContent()
           
 String getValue()
          Returns the the value of the immediate child of this Node object if a child exists and its value is text.
 Iterator getVisibleNamespacePrefixes()
           
 boolean hasAttribute(String name)
           
 boolean hasAttributeNS(String namespaceURI, String localName)
           
 boolean hasChildNodes()
           
 void internalSerialize(XMLStreamWriter writer, boolean cache)
           
 boolean removeAttribute(Name name)
           
 boolean removeAttribute(QName qname)
           
 void removeAttribute(String name)
           
 Attr removeAttributeNode(Attr attr)
           
 void removeAttributeNS(String namespaceURI, String localName)
           
 Node removeChild(Node oldChild)
           
 void removeContents()
           
 boolean removeNamespaceDeclaration(String prefix)
           
 void setAttribute(String name, String value)
           
 Attr setAttributeNode(Attr attr)
           
 Attr setAttributeNodeNS(Attr attr)
           
 void setAttributeNS(String namespaceURI, String qualifiedName, String value)
           
 SOAPElement setElementQName(QName newName)
           
 void setEncodingStyle(String encodingStyle)
          Sets the encoding style for this SOAPElement object to one specified.
 void setParent(org.apache.axiom.om.OMContainer parentElement)
           
 void setParentElement(SOAPElement parent)
          Sets the parent of this Node object to the given SOAPElement object.
 void setValue(String value)
          If this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) child of this node.
 String toString()
           
 
Methods inherited from class org.apache.axis2.saaj.NodeImplEx
getParent, getSchemaTypeInfo, getType, recycleNode, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setType
 
Methods inherited from class org.apache.axiom.om.impl.dom.NodeImpl
cloneNode, compareDocumentPosition, getBaseURI, getFeature, getLength, getNodeValue, getOMFactory, getUserData, hasAttributes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.xml.soap.Node
recycleNode
 
Methods inherited from interface org.w3c.dom.Element
getSchemaTypeInfo, setIdAttribute, setIdAttributeNode, setIdAttributeNS
 
Methods inherited from interface org.w3c.dom.Node
cloneNode, compareDocumentPosition, getBaseURI, getFeature, getNodeValue, getUserData, hasAttributes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Field Detail

element

protected org.apache.axiom.om.impl.dom.ElementImpl element
Using a delegate because we can't extend from org.apache.axiom.om.impl.dom.ElementImpl since this class must extend SNodeImpl

Constructor Detail

SOAPElementImpl

public SOAPElementImpl(org.apache.axiom.om.impl.dom.ElementImpl element)
Method Detail

discard

public void discard()
             throws org.apache.axiom.om.OMException
Throws:
org.apache.axiom.om.OMException

internalSerialize

public void internalSerialize(XMLStreamWriter writer,
                              boolean cache)
                       throws XMLStreamException
Throws:
XMLStreamException

addAttribute

public SOAPElement addAttribute(Name name,
                                String value)
                         throws SOAPException
Adds an attribute with the specified name and value to this SOAPElement object.

Specified by:
addAttribute in interface SOAPElement
Parameters:
name - a Name object with the name of the attribute
value - a String giving the value of the attribute
Returns:
the SOAPElement object into which the attribute was inserted
Throws:
SOAPException - if there is an error in creating the Attribute

addChildElement

public SOAPElement addChildElement(Name name)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Throws:
SOAPException

addChildElement

public SOAPElement addChildElement(SOAPElement soapElement)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Throws:
SOAPException

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface Node
Overrides:
getLocalName in class org.apache.axiom.om.impl.dom.NodeImpl

getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface Node
Overrides:
getNamespaceURI in class org.apache.axiom.om.impl.dom.NodeImpl

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface Node
Overrides:
getPrefix in class org.apache.axiom.om.impl.dom.NodeImpl

addChildElement

public SOAPElement addChildElement(String localName,
                                   String prefix,
                                   String namespaceURI)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Throws:
SOAPException

addChildElement

public SOAPElement addChildElement(String localName,
                                   String prefix)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Throws:
SOAPException

addChildElement

public SOAPElement addChildElement(String localName)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Throws:
SOAPException

addNamespaceDeclaration

public SOAPElement addNamespaceDeclaration(String prefix,
                                           String uri)
                                    throws SOAPException
Specified by:
addNamespaceDeclaration in interface SOAPElement
Throws:
SOAPException

addTextNode

public SOAPElement addTextNode(String text)
                        throws SOAPException
Creates a new Text object initialized with the given String and adds it to this SOAPElement object.

Specified by:
addTextNode in interface SOAPElement
Parameters:
text - a String object with the textual content to be added
Returns:
the SOAPElement object into which the new Text object was inserted
Throws:
SOAPException - if there is an error in creating the new Text object

getAllAttributes

public Iterator getAllAttributes()
Returns an iterator over all of the attribute names in this SOAPElement object. The iterator can be used to get the attribute names, which can then be passed to the method getAttributeValue to retrieve the value of each attribute.

Specified by:
getAllAttributes in interface SOAPElement
Returns:
an iterator over the names of the attributes

getAttributeValue

public String getAttributeValue(Name name)
Specified by:
getAttributeValue in interface SOAPElement

getChildElements

public Iterator getChildElements()
Returns an iterator over all the immediate content of this element. This includes Text objects as well as SOAPElement objects.

Specified by:
getChildElements in interface SOAPElement
Returns:
an iterator over Text and SOAPElement contained within this SOAPElement object

getChildElements

public Iterator getChildElements(Name name)
Specified by:
getChildElements in interface SOAPElement

getElementName

public Name getElementName()
Specified by:
getElementName in interface SOAPElement

getEncodingStyle

public String getEncodingStyle()
Specified by:
getEncodingStyle in interface SOAPElement

getNamespacePrefixes

public Iterator getNamespacePrefixes()
Specified by:
getNamespacePrefixes in interface SOAPElement

getNamespaceURI

public String getNamespaceURI(String prefix)
Specified by:
getNamespaceURI in interface SOAPElement

getVisibleNamespacePrefixes

public Iterator getVisibleNamespacePrefixes()
Specified by:
getVisibleNamespacePrefixes in interface SOAPElement

addAttribute

public SOAPElement addAttribute(QName qname,
                                String value)
                         throws SOAPException
Specified by:
addAttribute in interface SOAPElement
Throws:
SOAPException

addChildElement

public SOAPElement addChildElement(QName qname)
                            throws SOAPException
Specified by:
addChildElement in interface SOAPElement
Throws:
SOAPException

createQName

public QName createQName(String localName,
                         String prefix)
                  throws SOAPException
Creates a QName whose namespace URI is the one associated with the parameter, prefix, in the context of this SOAPElement. The remaining elements of the new QName are taken directly from the parameters, localName and prefix.

Specified by:
createQName in interface SOAPElement
Parameters:
localName - - a String containing the local part of the name. prefix - a String containing the prefix for the name.
Returns:
a QName with the specified localName and prefix, and with a namespace that is associated with the prefix in the context of this SOAPElement. This namespace will be the same as the one that would be returned by getNamespaceURI(String) if it were given prefix as its parameter.
Throws:
SOAPException - - if the QName cannot be created.
Since:
SAAJ 1.3

getAllAttributesAsQNames

public Iterator getAllAttributesAsQNames()
Specified by:
getAllAttributesAsQNames in interface SOAPElement

getAttributeValue

public String getAttributeValue(QName qname)
Specified by:
getAttributeValue in interface SOAPElement

getChildElements

public Iterator getChildElements(QName qname)
Specified by:
getChildElements in interface SOAPElement

getElementQName

public QName getElementQName()
Specified by:
getElementQName in interface SOAPElement

removeAttribute

public boolean removeAttribute(QName qname)
Specified by:
removeAttribute in interface SOAPElement

setElementQName

public SOAPElement setElementQName(QName newName)
                            throws SOAPException
Specified by:
setElementQName in interface SOAPElement
Throws:
SOAPException

removeAttribute

public boolean removeAttribute(Name name)
Specified by:
removeAttribute in interface SOAPElement

removeContents

public void removeContents()
Specified by:
removeContents in interface SOAPElement

removeNamespaceDeclaration

public boolean removeNamespaceDeclaration(String prefix)
Specified by:
removeNamespaceDeclaration in interface SOAPElement

setEncodingStyle

public void setEncodingStyle(String encodingStyle)
                      throws SOAPException
Sets the encoding style for this SOAPElement object to one specified.

Specified by:
setEncodingStyle in interface SOAPElement
Parameters:
encodingStyle - - a String giving the encoding style
Throws:
IllegalArgumentException - - if there was a problem in the encoding style being set. SOAPException - if setting the encodingStyle is invalid for this SOAPElement.
SOAPException

setParent

public void setParent(org.apache.axiom.om.OMContainer parentElement)

getAttribute

public String getAttribute(String name)
Specified by:
getAttribute in interface Element

getAttributeNode

public Attr getAttributeNode(String name)
Specified by:
getAttributeNode in interface Element

getAttributeNodeNS

public Attr getAttributeNodeNS(String namespaceURI,
                               String localName)
Specified by:
getAttributeNodeNS in interface Element

getAttributeNS

public String getAttributeNS(String namespaceURI,
                             String localName)
Specified by:
getAttributeNS in interface Element

getElementsByTagName

public NodeList getElementsByTagName(String name)
Specified by:
getElementsByTagName in interface Element

getElementsByTagNameNS

public NodeList getElementsByTagNameNS(String namespaceURI,
                                       String localName)
Specified by:
getElementsByTagNameNS in interface Element

getTagName

public String getTagName()
Specified by:
getTagName in interface Element

hasAttribute

public boolean hasAttribute(String name)
Specified by:
hasAttribute in interface Element

hasAttributeNS

public boolean hasAttributeNS(String namespaceURI,
                              String localName)
Specified by:
hasAttributeNS in interface Element

removeAttribute

public void removeAttribute(String name)
                     throws DOMException
Specified by:
removeAttribute in interface Element
Throws:
DOMException

removeAttributeNode

public Attr removeAttributeNode(Attr attr)
                         throws DOMException
Specified by:
removeAttributeNode in interface Element
Throws:
DOMException

removeAttributeNS

public void removeAttributeNS(String namespaceURI,
                              String localName)
                       throws DOMException
Specified by:
removeAttributeNS in interface Element
Throws:
DOMException

setAttribute

public void setAttribute(String name,
                         String value)
                  throws DOMException
Specified by:
setAttribute in interface Element
Throws:
DOMException

setAttributeNode

public Attr setAttributeNode(Attr attr)
                      throws DOMException
Specified by:
setAttributeNode in interface Element
Throws:
DOMException

setAttributeNodeNS

public Attr setAttributeNodeNS(Attr attr)
                        throws DOMException
Specified by:
setAttributeNodeNS in interface Element
Throws:
DOMException

setAttributeNS

public void setAttributeNS(String namespaceURI,
                           String qualifiedName,
                           String value)
                    throws DOMException
Specified by:
setAttributeNS in interface Element
Throws:
DOMException

getNodeName

public String getNodeName()
Specified by:
getNodeName in interface Node

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface Node

getElement

public org.apache.axiom.om.impl.dom.ElementImpl getElement()

getParentElement

public SOAPElement getParentElement()
Returns the parent element of this Node object. This method can throw an UnsupportedOperationException if the tree is not kept in memory.

Overrides:
getParentElement in class NodeImplEx
Returns:
the SOAPElement object that is the parent of this Node object or null if this Node object is root
Throws:
UnsupportedOperationException - if the whole tree is not kept in memory
See Also:
setParentElement(javax.xml.soap.SOAPElement)

setParentElement

public void setParentElement(SOAPElement parent)
                      throws SOAPException
Description copied from class: NodeImplEx
Sets the parent of this Node object to the given SOAPElement object.

Overrides:
setParentElement in class NodeImplEx
Parameters:
parent - the SOAPElement object to be set as the parent of this Node object
Throws:
SOAPException - if there is a problem in setting the parent to the given element
See Also:
getParentElement()

getOwnerDocument

public Document getOwnerDocument()
Find the Document that this Node belongs to (the document in whose context the Node was created). The Node may or may not

Specified by:
getOwnerDocument in interface Node

getValue

public String getValue()
Returns the the value of the immediate child of this Node object if a child exists and its value is text.

Overrides:
getValue in class NodeImplEx
Returns:
a String with the text of the immediate child of this Node object if (1) there is a child and (2) the child is a Text object; null otherwise

getTextContent

public String getTextContent()
                      throws DOMException
Specified by:
getTextContent in interface Node
Overrides:
getTextContent in class org.apache.axiom.om.impl.dom.NodeImpl
Throws:
DOMException

clone

protected Object clone()
                throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

getFirstChild

public Node getFirstChild()
Specified by:
getFirstChild in interface Node
Overrides:
getFirstChild in class org.apache.axiom.om.impl.dom.NodeImpl

getLastChild

public Node getLastChild()
Method getLastChild

Specified by:
getLastChild in interface Node
Overrides:
getLastChild in class org.apache.axiom.om.impl.dom.NodeImpl
See Also:
Node.getLastChild()

getParentNode

public Node getParentNode()
Specified by:
getParentNode in interface Node
Overrides:
getParentNode in class NodeImplEx

getNextSibling

public Node getNextSibling()
dom Node method

Specified by:
getNextSibling in interface Node
Overrides:
getNextSibling in class org.apache.axiom.om.impl.dom.NodeImpl

getPreviousSibling

public Node getPreviousSibling()
Specified by:
getPreviousSibling in interface Node
Overrides:
getPreviousSibling in class org.apache.axiom.om.impl.dom.NodeImpl

getChildNodes

public NodeList getChildNodes()
Specified by:
getChildNodes in interface Node
Overrides:
getChildNodes in class org.apache.axiom.om.impl.dom.NodeImpl

hasChildNodes

public boolean hasChildNodes()
Specified by:
hasChildNodes in interface Node
Overrides:
hasChildNodes in class org.apache.axiom.om.impl.dom.NodeImpl

setValue

public void setValue(String value)
If this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) child of this node. The value of the immediate child of this node can be set only if, there is one child node and that node is a Text node, or if there are no children in which case a child Text node will be created.

Parameters:
value - the text to set
Throws:
IllegalStateException - if the node is not a Text node and either has more than one child node or has a child node that is not a Text node

detachNode

public void detachNode()
Description copied from class: NodeImplEx
Removes this Node object from the tree. Once removed, this node can be garbage collected if there are no application references to it.

Overrides:
detachNode in class NodeImplEx

detach

public org.apache.axiom.om.OMNode detach()
Overrides:
detach in class NodeImplEx

getAttributes

public NamedNodeMap getAttributes()
Returns the collection of attributes associated with this node, or null if none. At this writing, Element is the only type of node which will ever have attributes.

Specified by:
getAttributes in interface Node
Overrides:
getAttributes in class org.apache.axiom.om.impl.dom.NodeImpl
See Also:
ElementImpl

toString

public String toString()
Overrides:
toString in class Object

removeChild

public Node removeChild(Node oldChild)
                 throws DOMException
Specified by:
removeChild in interface Node
Overrides:
removeChild in class org.apache.axiom.om.impl.dom.NodeImpl
Throws:
DOMException

appendChild

public Node appendChild(Node child)
                 throws DOMException
Specified by:
appendChild in interface Node
Overrides:
appendChild in class org.apache.axiom.om.impl.dom.NodeImpl
Throws:
DOMException

appendText

protected Text appendText(Text child)
                   throws SOAPException
Throws:
SOAPException

appendElement

protected Element appendElement(org.apache.axiom.om.impl.dom.ElementImpl child)
                         throws SOAPException
Throws:
SOAPException

copyContents

protected void copyContents(SOAPElementImpl childEle,
                            Node child)
                     throws SOAPException
Throws:
SOAPException


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.