1 /*
   2  * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.xml.soap;
  27 
  28 /**
  29  * A representation of a node (element) in an XML document.
  30  * This interface extnends the standard DOM Node interface with methods for
  31  * getting and setting the value of a node, for
  32  * getting and setting the parent of a node, and for removing a node.
  33  *
  34  * @since 1.6
  35  */
  36 public interface Node extends org.w3c.dom.Node {
  37     /**
  38      * Returns the value of this node if this is a {@code Text} node or the
  39      * value of the immediate child of this node otherwise.
  40      * If there is an immediate child of this {@code Node} that it is a
  41      * {@code Text} node then it's value will be returned. If there is
  42      * more than one {@code Text} node then the value of the first
  43      * {@code Text} Node will be returned.
  44      * Otherwise {@code null} is returned.
  45      *
  46      * @return a {@code String} with the text of this node if this is a
  47      *          {@code Text} node or the text contained by the first
  48      *          immediate child of this {@code Node} object that is a
  49      *          {@code Text} object if such a child exists;
  50      *          {@code null} otherwise.
  51      */
  52     public String 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} node, or if
  59      * there are no children in which case a child {@code Text} node will be
  60      * created.
  61      *

  62      * @exception IllegalStateException if the node is not a {@code Text}
  63      *              node and either has more than one child node or has a child
  64      *              node that is not a {@code Text} node.
  65      *
  66      * @since 1.6, SAAJ 1.2
  67      */
  68     public void setValue(String value);
  69 
  70     /**
  71      * Sets the parent of this {@code Node} object to the given
  72      * {@code SOAPElement} object.
  73      *
  74      * @param parent the {@code SOAPElement} object to be set as
  75      *       the parent of this {@code Node} 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 parent) throws SOAPException;
  82 
  83     /**
  84      * Returns the parent element of this {@code Node} object.
  85      * This method can throw an {@code UnsupportedOperationException}
  86      * if the tree is not kept in memory.
  87      *
  88      * @return the {@code SOAPElement} object that is the parent of
  89      *         this {@code Node} object or {@code null} if this
  90      *         {@code Node} object is root
  91      *
  92      * @exception UnsupportedOperationException if the whole tree is not
  93      *            kept in memory
  94      * @see #setParentElement
  95      */
  96     public SOAPElement getParentElement();
  97 
  98     /**
  99      * Removes this {@code Node} object from the tree.
 100      */
 101     public void detachNode();
 102 
 103     /**
 104      * Notifies the implementation that this {@code Node}
 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} implies that the method
 110      * {@code detachNode} has been called previously.
 111      */
 112     public void recycleNode();
 113 
 114 }
--- EOF ---