Save This Page
Home » openjdk-7 » javax » xml » soap » [javadoc | source]
    1   /*
    2    * $Id: Node.java,v 1.12 2004/04/02 01:24:17 ofung Exp $
    3    * $Revision: 1.12 $
    4    * $Date: 2004/04/02 01:24:17 $
    5    */
    6   
    7   /*
    8    * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
    9    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   10    *
   11    * This code is free software; you can redistribute it and/or modify it
   12    * under the terms of the GNU General Public License version 2 only, as
   13    * published by the Free Software Foundation.  Sun designates this
   14    * particular file as subject to the "Classpath" exception as provided
   15    * by Sun in the LICENSE file that accompanied this code.
   16    *
   17    * This code is distributed in the hope that it will be useful, but WITHOUT
   18    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20    * version 2 for more details (a copy is included in the LICENSE file that
   21    * accompanied this code).
   22    *
   23    * You should have received a copy of the GNU General Public License version
   24    * 2 along with this work; if not, write to the Free Software Foundation,
   25    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   26    *
   27    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   28    * CA 95054 USA or visit www.sun.com if you need additional information or
   29    * have any questions.
   30    */
   31   package javax.xml.soap;
   32   
   33   /**
   34    * A representation of a node (element) in an XML document.
   35    * This interface extnends the standard DOM Node interface with methods for
   36    * getting and setting the value of a node, for
   37    * getting and setting the parent of a node, and for removing a node.
   38    */
   39   public interface Node extends org.w3c.dom.Node {
   40       /**
   41        * Returns the value of this node if this is a <code>Text</code> node or the
   42        * value of the immediate child of this node otherwise.
   43        * If there is an immediate child of this <code>Node</code> that it is a
   44        * <code>Text</code> node then it's value will be returned. If there is
   45        * more than one <code>Text</code> node then the value of the first
   46        * <code>Text</code> Node will be returned.
   47        * Otherwise <code>null</code> is returned.
   48        *
   49        * @return a <code>String</code> with the text of this node if this is a
   50        *          <code>Text</code> node or the text contained by the first
   51        *          immediate child of this <code>Node</code> object that is a
   52        *          <code>Text</code> object if such a child exists;
   53        *          <code>null</code> otherwise.
   54        */
   55       public String getValue();
   56   
   57       /**
   58        * If this is a Text node then this method will set its value,
   59        * otherwise it sets the value of  the immediate (Text) child of this node.
   60        * The value of the immediate child of this node can be set only if, there is
   61        * one child node and that node is a <code>Text</code> node, or if
   62        * there are no children in which case a child <code>Text</code> node will be
   63        * created.
   64        *
   65        * @exception IllegalStateException if the node is not a <code>Text</code>
   66        *              node and either has more than one child node or has a child
   67        *              node that is not a <code>Text</code> node.
   68        *
   69        * @since SAAJ 1.2
   70        */
   71       public void setValue(String value);
   72   
   73       /**
   74        * Sets the parent of this <code>Node</code> object to the given
   75        * <code>SOAPElement</code> object.
   76        *
   77        * @param parent the <code>SOAPElement</code> object to be set as
   78        *       the parent of this <code>Node</code> object
   79        *
   80        * @exception SOAPException if there is a problem in setting the
   81        *                          parent to the given element
   82        * @see #getParentElement
   83        */
   84       public void setParentElement(SOAPElement parent) throws SOAPException;
   85   
   86       /**
   87        * Returns the parent element of this <code>Node</code> object.
   88        * This method can throw an <code>UnsupportedOperationException</code>
   89        * if the tree is not kept in memory.
   90        *
   91        * @return the <code>SOAPElement</code> object that is the parent of
   92        *         this <code>Node</code> object or <code>null</code> if this
   93        *         <code>Node</code> object is root
   94        *
   95        * @exception UnsupportedOperationException if the whole tree is not
   96        *            kept in memory
   97        * @see #setParentElement
   98        */
   99       public SOAPElement getParentElement();
  100   
  101       /**
  102        * Removes this <code>Node</code> object from the tree.
  103        */
  104       public void detachNode();
  105   
  106       /**
  107        * Notifies the implementation that this <code>Node</code>
  108        * object is no longer being used by the application and that the
  109        * implementation is free to reuse this object for nodes that may
  110        * be created later.
  111        * <P>
  112        * Calling the method <code>recycleNode</code> implies that the method
  113        * <code>detachNode</code> has been called previously.
  114        */
  115       public void recycleNode();
  116   
  117   }

Save This Page
Home » openjdk-7 » javax » xml » soap » [javadoc | source]