KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > soap > Node


1 /*
2  * $Id: Node.java,v 1.13 2005/04/05 20:49:49 mk125090 Exp $
3  * $Revision: 1.13 $
4  * $Date: 2005/04/05 20:49:49 $
5  */

6
7 /*
8  * The contents of this file are subject to the terms
9  * of the Common Development and Distribution License
10  * (the License). You may not use this file except in
11  * compliance with the License.
12  *
13  * You can obtain a copy of the license at
14  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
15  * See the License for the specific language governing
16  * permissions and limitations under the License.
17  *
18  * When distributing Covered Code, include this CDDL
19  * Header Notice in each file and include the License file
20  * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
21  * If applicable, add the following below the CDDL Header,
22  * with the fields enclosed by brackets [] replaced by
23  * you own identifying information:
24  * "Portions Copyrighted [year] [name of copyright owner]"
25  *
26  * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
27  */

28 package javax.xml.soap;
29
30 /**
31  * A representation of a node (element) in an XML document.
32  * This interface extnends the standard DOM Node interface with methods for
33  * getting and setting the value of a node, for
34  * getting and setting the parent of a node, and for removing a node.
35  */

36 public interface Node extends org.w3c.dom.Node JavaDoc {
37     /**
38      * Returns the value of this node if this is a <code>Text</code> node or the
39      * value of the immediate child of this node otherwise.
40      * If there is an immediate child of this <code>Node</code> that it is a
41      * <code>Text</code> node then it's value will be returned. If there is
42      * more than one <code>Text</code> node then the value of the first
43      * <code>Text</code> Node will be returned.
44      * Otherwise <code>null</code> is returned.
45      *
46      * @return a <code>String</code> with the text of this node if this is a
47      * <code>Text</code> node or the text contained by the first
48      * immediate child of this <code>Node</code> object that is a
49      * <code>Text</code> object if such a child exists;
50      * <code>null</code> otherwise.
51      */

52     public String JavaDoc getValue();
53     
54     /**
55      * If this is a Text node then this method will set its value,
56      * otherwise it sets the value of the immediate (Text) child of this node.
57      * The value of the immediate child of this node can be set only if, there is
58      * one child node and that node is a <code>Text</code> node, or if
59      * there are no children in which case a child <code>Text</code> node will be
60      * created.
61      *
62      * @exception IllegalStateException if the node is not a <code>Text</code>
63      * node and either has more than one child node or has a child
64      * node that is not a <code>Text</code> node.
65      *
66      * @since SAAJ 1.2
67      */

68     public void setValue(String JavaDoc value);
69
70     /**
71      * Sets the parent of this <code>Node</code> object to the given
72      * <code>SOAPElement</code> object.
73      *
74      * @param parent the <code>SOAPElement</code> object to be set as
75      * the parent of this <code>Node</code> object
76      *
77      * @exception SOAPException if there is a problem in setting the
78      * parent to the given element
79      * @see #getParentElement
80      */

81     public void setParentElement(SOAPElement JavaDoc parent) throws SOAPException JavaDoc;
82
83     /**
84      * Returns the parent element of this <code>Node</code> object.
85      * This method can throw an <code>UnsupportedOperationException</code>
86      * if the tree is not kept in memory.
87      *
88      * @return the <code>SOAPElement</code> object that is the parent of
89      * this <code>Node</code> object or <code>null</code> if this
90      * <code>Node</code> object is root
91      *
92      * @exception UnsupportedOperationException if the whole tree is not
93      * kept in memory
94      * @see #setParentElement
95      */

96     public SOAPElement JavaDoc getParentElement();
97
98     /**
99      * Removes this <code>Node</code> object from the tree.
100      */

101     public void detachNode();
102
103     /**
104      * Notifies the implementation that this <code>Node</code>
105      * object is no longer being used by the application and that the
106      * implementation is free to reuse this object for nodes that may
107      * be created later.
108      * <P>
109      * Calling the method <code>recycleNode</code> implies that the method
110      * <code>detachNode</code> has been called previously.
111      */

112     public void recycleNode();
113
114 }
115
Popular Tags