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