public interface Node {
// Public Instance Methods
public abstract void detachNode( );
public abstract SOAPElement getParentElement( );
public abstract String getValue( );
public abstract void recycleNode( );
public abstract void setParentElement(SOAPElement parent)
throws SOAPException;
}
Node is an interface that represents a node in a
DOM-like tree representation of a SOAP message. In particular,
Node owns the reference required to maintain the
linkage between a SOAP element and its single parent. In the SAAJ
API, Node is never used directly. Instead, the API
deals with its two derived interfaces:
SOAPElement, which adds the capability to attach
attributes and namespace declarations, and Text,
which represents textual content.
The getParentElement( ) method returns a reference
to the SOAPElement that resides above this
Node in the element hierarchy, whereas
setParentElement( ) links the node beneath a given
SOAPElement. The detachNode( )
method can be used to remove the Node from the
tree. If the application code knows that it no longer needs a
particular Node, it should use the
recycleNode( ) method to allow it to be
garbage-collected once all hard references to it are removed. As a
side effect, the Node is removed from its parent
if it is still linked when this method is called.
getValue( ) is a convenience method that returns a
string that is the value associated with a Text
child of this Node. It returns
null if the node does not have such a child. Text
can be associated with a Node using the
addTextNode( ) method of
SOAPElement, which actually creates a
Text node and adds it as a child of the element.
Interestingly, although a Node may have a parent,
it does not have any methods that allow access to other
Nodes that are its direct descendents, since the
concept of child elements belongs to SOAPElement
instead. However, since every SOAPElement is also
a Node, it is incorrect to regard
Node as simply a leaf in a tree structure.