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 | import java.util.Iterator; |
aoqi@0 | 29 | |
aoqi@0 | 30 | import javax.xml.namespace.QName; |
aoqi@0 | 31 | |
aoqi@0 | 32 | /** |
aoqi@0 | 33 | * An object representing an element of a SOAP message that is allowed but not |
aoqi@0 | 34 | * specifically prescribed by a SOAP specification. This interface serves as the |
aoqi@0 | 35 | * base interface for those objects that are specifically prescribed by a SOAP |
aoqi@0 | 36 | * specification. |
aoqi@0 | 37 | * <p> |
aoqi@0 | 38 | * Methods in this interface that are required to return SAAJ specific objects |
aoqi@0 | 39 | * may "silently" replace nodes in the tree as required to successfully return |
aoqi@0 | 40 | * objects of the correct type. See {@link #getChildElements()} and |
aoqi@0 | 41 | * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>} |
aoqi@0 | 42 | * for details. |
aoqi@0 | 43 | */ |
aoqi@0 | 44 | public interface SOAPElement extends Node, org.w3c.dom.Element { |
aoqi@0 | 45 | |
aoqi@0 | 46 | /** |
aoqi@0 | 47 | * Creates a new <code>SOAPElement</code> object initialized with the |
aoqi@0 | 48 | * given <code>Name</code> object and adds the new element to this |
aoqi@0 | 49 | * <code>SOAPElement</code> object. |
aoqi@0 | 50 | * <P> |
aoqi@0 | 51 | * This method may be deprecated in a future release of SAAJ in favor of |
aoqi@0 | 52 | * addChildElement(javax.xml.namespace.QName) |
aoqi@0 | 53 | * |
aoqi@0 | 54 | * @param name a <code>Name</code> object with the XML name for the |
aoqi@0 | 55 | * new element |
aoqi@0 | 56 | * |
aoqi@0 | 57 | * @return the new <code>SOAPElement</code> object that was created |
aoqi@0 | 58 | * @exception SOAPException if there is an error in creating the |
aoqi@0 | 59 | * <code>SOAPElement</code> object |
aoqi@0 | 60 | * @see SOAPElement#addChildElement(javax.xml.namespace.QName) |
aoqi@0 | 61 | */ |
aoqi@0 | 62 | public SOAPElement addChildElement(Name name) throws SOAPException; |
aoqi@0 | 63 | |
aoqi@0 | 64 | /** |
aoqi@0 | 65 | * Creates a new <code>SOAPElement</code> object initialized with the given |
aoqi@0 | 66 | * <code>QName</code> object and adds the new element to this <code>SOAPElement</code> |
aoqi@0 | 67 | * object. The <i>namespace</i>, <i>localname</i> and <i>prefix</i> of the new |
aoqi@0 | 68 | * <code>SOAPElement</code> are all taken from the <code>qname</code> argument. |
aoqi@0 | 69 | * |
aoqi@0 | 70 | * @param qname a <code>QName</code> object with the XML name for the |
aoqi@0 | 71 | * new element |
aoqi@0 | 72 | * |
aoqi@0 | 73 | * @return the new <code>SOAPElement</code> object that was created |
aoqi@0 | 74 | * @exception SOAPException if there is an error in creating the |
aoqi@0 | 75 | * <code>SOAPElement</code> object |
aoqi@0 | 76 | * @see SOAPElement#addChildElement(Name) |
aoqi@0 | 77 | * @since SAAJ 1.3 |
aoqi@0 | 78 | */ |
aoqi@0 | 79 | public SOAPElement addChildElement(QName qname) throws SOAPException; |
aoqi@0 | 80 | |
aoqi@0 | 81 | /** |
aoqi@0 | 82 | * Creates a new <code>SOAPElement</code> object initialized with the |
aoqi@0 | 83 | * specified local name and adds the new element to this |
aoqi@0 | 84 | * <code>SOAPElement</code> object. |
aoqi@0 | 85 | * The new <code>SOAPElement</code> inherits any in-scope default namespace. |
aoqi@0 | 86 | * |
aoqi@0 | 87 | * @param localName a <code>String</code> giving the local name for |
aoqi@0 | 88 | * the element |
aoqi@0 | 89 | * @return the new <code>SOAPElement</code> object that was created |
aoqi@0 | 90 | * @exception SOAPException if there is an error in creating the |
aoqi@0 | 91 | * <code>SOAPElement</code> object |
aoqi@0 | 92 | */ |
aoqi@0 | 93 | public SOAPElement addChildElement(String localName) throws SOAPException; |
aoqi@0 | 94 | |
aoqi@0 | 95 | /** |
aoqi@0 | 96 | * Creates a new <code>SOAPElement</code> object initialized with the |
aoqi@0 | 97 | * specified local name and prefix and adds the new element to this |
aoqi@0 | 98 | * <code>SOAPElement</code> object. |
aoqi@0 | 99 | * |
aoqi@0 | 100 | * @param localName a <code>String</code> giving the local name for |
aoqi@0 | 101 | * the new element |
aoqi@0 | 102 | * @param prefix a <code>String</code> giving the namespace prefix for |
aoqi@0 | 103 | * the new element |
aoqi@0 | 104 | * |
aoqi@0 | 105 | * @return the new <code>SOAPElement</code> object that was created |
aoqi@0 | 106 | * @exception SOAPException if the <code>prefix</code> is not valid in the |
aoqi@0 | 107 | * context of this <code>SOAPElement</code> or if there is an error in creating the |
aoqi@0 | 108 | * <code>SOAPElement</code> object |
aoqi@0 | 109 | */ |
aoqi@0 | 110 | public SOAPElement addChildElement(String localName, String prefix) |
aoqi@0 | 111 | throws SOAPException; |
aoqi@0 | 112 | |
aoqi@0 | 113 | /** |
aoqi@0 | 114 | * Creates a new <code>SOAPElement</code> object initialized with the |
aoqi@0 | 115 | * specified local name, prefix, and URI and adds the new element to this |
aoqi@0 | 116 | * <code>SOAPElement</code> object. |
aoqi@0 | 117 | * |
aoqi@0 | 118 | * @param localName a <code>String</code> giving the local name for |
aoqi@0 | 119 | * the new element |
aoqi@0 | 120 | * @param prefix a <code>String</code> giving the namespace prefix for |
aoqi@0 | 121 | * the new element |
aoqi@0 | 122 | * @param uri a <code>String</code> giving the URI of the namespace |
aoqi@0 | 123 | * to which the new element belongs |
aoqi@0 | 124 | * |
aoqi@0 | 125 | * @return the new <code>SOAPElement</code> object that was created |
aoqi@0 | 126 | * @exception SOAPException if there is an error in creating the |
aoqi@0 | 127 | * <code>SOAPElement</code> object |
aoqi@0 | 128 | */ |
aoqi@0 | 129 | public SOAPElement addChildElement(String localName, String prefix, |
aoqi@0 | 130 | String uri) |
aoqi@0 | 131 | throws SOAPException; |
aoqi@0 | 132 | |
aoqi@0 | 133 | /** |
aoqi@0 | 134 | * Add a <code>SOAPElement</code> as a child of this |
aoqi@0 | 135 | * <code>SOAPElement</code> instance. The <code>SOAPElement</code> |
aoqi@0 | 136 | * is expected to be created by a |
aoqi@0 | 137 | * <code>SOAPFactory</code>. Callers should not rely on the |
aoqi@0 | 138 | * element instance being added as is into the XML |
aoqi@0 | 139 | * tree. Implementations could end up copying the content |
aoqi@0 | 140 | * of the <code>SOAPElement</code> passed into an instance of |
aoqi@0 | 141 | * a different <code>SOAPElement</code> implementation. For |
aoqi@0 | 142 | * instance if <code>addChildElement()</code> is called on a |
aoqi@0 | 143 | * <code>SOAPHeader</code>, <code>element</code> will be copied |
aoqi@0 | 144 | * into an instance of a <code>SOAPHeaderElement</code>. |
aoqi@0 | 145 | * |
aoqi@0 | 146 | * <P>The fragment rooted in <code>element</code> is either added |
aoqi@0 | 147 | * as a whole or not at all, if there was an error. |
aoqi@0 | 148 | * |
aoqi@0 | 149 | * <P>The fragment rooted in <code>element</code> cannot contain |
aoqi@0 | 150 | * elements named "Envelope", "Header" or "Body" and in the SOAP |
aoqi@0 | 151 | * namespace. Any namespace prefixes present in the fragment |
aoqi@0 | 152 | * should be fully resolved using appropriate namespace |
aoqi@0 | 153 | * declarations within the fragment itself. |
aoqi@0 | 154 | * |
aoqi@0 | 155 | * @param element the <code>SOAPElement</code> to be added as a |
aoqi@0 | 156 | * new child |
aoqi@0 | 157 | * |
aoqi@0 | 158 | * @exception SOAPException if there was an error in adding this |
aoqi@0 | 159 | * element as a child |
aoqi@0 | 160 | * |
aoqi@0 | 161 | * @return an instance representing the new SOAP element that was |
aoqi@0 | 162 | * actually added to the tree. |
aoqi@0 | 163 | */ |
aoqi@0 | 164 | public SOAPElement addChildElement(SOAPElement element) |
aoqi@0 | 165 | throws SOAPException; |
aoqi@0 | 166 | |
aoqi@0 | 167 | /** |
aoqi@0 | 168 | * Detaches all children of this <code>SOAPElement</code>. |
aoqi@0 | 169 | * <p> |
aoqi@0 | 170 | * This method is useful for rolling back the construction of partially |
aoqi@0 | 171 | * completed <code>SOAPHeaders</code> and <code>SOAPBodys</code> in |
aoqi@0 | 172 | * preparation for sending a fault when an error condition is detected. It |
aoqi@0 | 173 | * is also useful for recycling portions of a document within a SOAP |
aoqi@0 | 174 | * message. |
aoqi@0 | 175 | * |
aoqi@0 | 176 | * @since SAAJ 1.2 |
aoqi@0 | 177 | */ |
aoqi@0 | 178 | public abstract void removeContents(); |
aoqi@0 | 179 | |
aoqi@0 | 180 | /** |
aoqi@0 | 181 | * Creates a new <code>Text</code> object initialized with the given |
aoqi@0 | 182 | * <code>String</code> and adds it to this <code>SOAPElement</code> object. |
aoqi@0 | 183 | * |
aoqi@0 | 184 | * @param text a <code>String</code> object with the textual content to be added |
aoqi@0 | 185 | * |
aoqi@0 | 186 | * @return the <code>SOAPElement</code> object into which |
aoqi@0 | 187 | * the new <code>Text</code> object was inserted |
aoqi@0 | 188 | * @exception SOAPException if there is an error in creating the |
aoqi@0 | 189 | * new <code>Text</code> object or if it is not legal to |
aoqi@0 | 190 | * attach it as a child to this |
aoqi@0 | 191 | * <code>SOAPElement</code> |
aoqi@0 | 192 | */ |
aoqi@0 | 193 | public SOAPElement addTextNode(String text) throws SOAPException; |
aoqi@0 | 194 | |
aoqi@0 | 195 | /** |
aoqi@0 | 196 | * Adds an attribute with the specified name and value to this |
aoqi@0 | 197 | * <code>SOAPElement</code> object. |
aoqi@0 | 198 | * |
aoqi@0 | 199 | * @param name a <code>Name</code> object with the name of the attribute |
aoqi@0 | 200 | * @param value a <code>String</code> giving the value of the attribute |
aoqi@0 | 201 | * @return the <code>SOAPElement</code> object into which the attribute was |
aoqi@0 | 202 | * inserted |
aoqi@0 | 203 | * |
aoqi@0 | 204 | * @exception SOAPException if there is an error in creating the |
aoqi@0 | 205 | * Attribute, or it is invalid to set |
aoqi@0 | 206 | an attribute with <code>Name</code> |
aoqi@0 | 207 | <code>name</code> on this SOAPElement. |
aoqi@0 | 208 | * @see SOAPElement#addAttribute(javax.xml.namespace.QName, String) |
aoqi@0 | 209 | */ |
aoqi@0 | 210 | public SOAPElement addAttribute(Name name, String value) |
aoqi@0 | 211 | throws SOAPException; |
aoqi@0 | 212 | |
aoqi@0 | 213 | /** |
aoqi@0 | 214 | * Adds an attribute with the specified name and value to this |
aoqi@0 | 215 | * <code>SOAPElement</code> object. |
aoqi@0 | 216 | * |
aoqi@0 | 217 | * @param qname a <code>QName</code> object with the name of the attribute |
aoqi@0 | 218 | * @param value a <code>String</code> giving the value of the attribute |
aoqi@0 | 219 | * @return the <code>SOAPElement</code> object into which the attribute was |
aoqi@0 | 220 | * inserted |
aoqi@0 | 221 | * |
aoqi@0 | 222 | * @exception SOAPException if there is an error in creating the |
aoqi@0 | 223 | * Attribute, or it is invalid to set |
aoqi@0 | 224 | an attribute with <code>QName</code> |
aoqi@0 | 225 | <code>qname</code> on this SOAPElement. |
aoqi@0 | 226 | * @see SOAPElement#addAttribute(Name, String) |
aoqi@0 | 227 | * @since SAAJ 1.3 |
aoqi@0 | 228 | */ |
aoqi@0 | 229 | public SOAPElement addAttribute(QName qname, String value) |
aoqi@0 | 230 | throws SOAPException; |
aoqi@0 | 231 | |
aoqi@0 | 232 | /** |
aoqi@0 | 233 | * Adds a namespace declaration with the specified prefix and URI to this |
aoqi@0 | 234 | * <code>SOAPElement</code> object. |
aoqi@0 | 235 | * |
aoqi@0 | 236 | * @param prefix a <code>String</code> giving the prefix of the namespace |
aoqi@0 | 237 | * @param uri a <code>String</code> giving the uri of the namespace |
aoqi@0 | 238 | * @return the <code>SOAPElement</code> object into which this |
aoqi@0 | 239 | * namespace declaration was inserted. |
aoqi@0 | 240 | * |
aoqi@0 | 241 | * @exception SOAPException if there is an error in creating the |
aoqi@0 | 242 | * namespace |
aoqi@0 | 243 | */ |
aoqi@0 | 244 | public SOAPElement addNamespaceDeclaration(String prefix, String uri) |
aoqi@0 | 245 | throws SOAPException; |
aoqi@0 | 246 | |
aoqi@0 | 247 | /** |
aoqi@0 | 248 | * Returns the value of the attribute with the specified name. |
aoqi@0 | 249 | * |
aoqi@0 | 250 | * @param name a <code>Name</code> object with the name of the attribute |
aoqi@0 | 251 | * @return a <code>String</code> giving the value of the specified |
aoqi@0 | 252 | * attribute, Null if there is no such attribute |
aoqi@0 | 253 | * @see SOAPElement#getAttributeValue(javax.xml.namespace.QName) |
aoqi@0 | 254 | */ |
aoqi@0 | 255 | public String getAttributeValue(Name name); |
aoqi@0 | 256 | |
aoqi@0 | 257 | /** |
aoqi@0 | 258 | * Returns the value of the attribute with the specified qname. |
aoqi@0 | 259 | * |
aoqi@0 | 260 | * @param qname a <code>QName</code> object with the qname of the attribute |
aoqi@0 | 261 | * @return a <code>String</code> giving the value of the specified |
aoqi@0 | 262 | * attribute, Null if there is no such attribute |
aoqi@0 | 263 | * @see SOAPElement#getAttributeValue(Name) |
aoqi@0 | 264 | * @since SAAJ 1.3 |
aoqi@0 | 265 | */ |
aoqi@0 | 266 | public String getAttributeValue(QName qname); |
aoqi@0 | 267 | |
aoqi@0 | 268 | /** |
aoqi@0 | 269 | * Returns an <code>Iterator</code> over all of the attribute |
aoqi@0 | 270 | * <code>Name</code> objects in this |
aoqi@0 | 271 | * <code>SOAPElement</code> object. The iterator can be used to get |
aoqi@0 | 272 | * the attribute names, which can then be passed to the method |
aoqi@0 | 273 | * <code>getAttributeValue</code> to retrieve the value of each |
aoqi@0 | 274 | * attribute. |
aoqi@0 | 275 | * |
aoqi@0 | 276 | * @see SOAPElement#getAllAttributesAsQNames() |
aoqi@0 | 277 | * @return an iterator over the names of the attributes |
aoqi@0 | 278 | */ |
aoqi@0 | 279 | public Iterator getAllAttributes(); |
aoqi@0 | 280 | |
aoqi@0 | 281 | /** |
aoqi@0 | 282 | * Returns an <code>Iterator</code> over all of the attributes |
aoqi@0 | 283 | * in this <code>SOAPElement</code> as <code>QName</code> objects. |
aoqi@0 | 284 | * The iterator can be used to get the attribute QName, which can then |
aoqi@0 | 285 | * be passed to the method <code>getAttributeValue</code> to retrieve |
aoqi@0 | 286 | * the value of each attribute. |
aoqi@0 | 287 | * |
aoqi@0 | 288 | * @return an iterator over the QNames of the attributes |
aoqi@0 | 289 | * @see SOAPElement#getAllAttributes() |
aoqi@0 | 290 | * @since SAAJ 1.3 |
aoqi@0 | 291 | */ |
aoqi@0 | 292 | public Iterator getAllAttributesAsQNames(); |
aoqi@0 | 293 | |
aoqi@0 | 294 | |
aoqi@0 | 295 | /** |
aoqi@0 | 296 | * Returns the URI of the namespace that has the given prefix. |
aoqi@0 | 297 | * |
aoqi@0 | 298 | * @param prefix a <code>String</code> giving the prefix of the namespace |
aoqi@0 | 299 | * for which to search |
aoqi@0 | 300 | * @return a <code>String</code> with the uri of the namespace that has |
aoqi@0 | 301 | * the given prefix |
aoqi@0 | 302 | */ |
aoqi@0 | 303 | public String getNamespaceURI(String prefix); |
aoqi@0 | 304 | |
aoqi@0 | 305 | /** |
aoqi@0 | 306 | * Returns an <code>Iterator</code> over the namespace prefix |
aoqi@0 | 307 | * <code>String</code>s declared by this element. The prefixes returned by |
aoqi@0 | 308 | * this iterator can be passed to the method |
aoqi@0 | 309 | * <code>getNamespaceURI</code> to retrieve the URI of each namespace. |
aoqi@0 | 310 | * |
aoqi@0 | 311 | * @return an iterator over the namespace prefixes in this |
aoqi@0 | 312 | * <code>SOAPElement</code> object |
aoqi@0 | 313 | */ |
aoqi@0 | 314 | public Iterator getNamespacePrefixes(); |
aoqi@0 | 315 | |
aoqi@0 | 316 | /** |
aoqi@0 | 317 | * Returns an <code>Iterator</code> over the namespace prefix |
aoqi@0 | 318 | * <code>String</code>s visible to this element. The prefixes returned by |
aoqi@0 | 319 | * this iterator can be passed to the method |
aoqi@0 | 320 | * <code>getNamespaceURI</code> to retrieve the URI of each namespace. |
aoqi@0 | 321 | * |
aoqi@0 | 322 | * @return an iterator over the namespace prefixes are within scope of this |
aoqi@0 | 323 | * <code>SOAPElement</code> object |
aoqi@0 | 324 | * |
aoqi@0 | 325 | * @since SAAJ 1.2 |
aoqi@0 | 326 | */ |
aoqi@0 | 327 | public Iterator getVisibleNamespacePrefixes(); |
aoqi@0 | 328 | |
aoqi@0 | 329 | /** |
aoqi@0 | 330 | * Creates a <code>QName</code> whose namespace URI is the one associated |
aoqi@0 | 331 | * with the parameter, <code>prefix</code>, in the context of this |
aoqi@0 | 332 | * <code>SOAPElement</code>. The remaining elements of the new |
aoqi@0 | 333 | * <code>QName</code> are taken directly from the parameters, |
aoqi@0 | 334 | * <code>localName</code> and <code>prefix</code>. |
aoqi@0 | 335 | * |
aoqi@0 | 336 | * @param localName |
aoqi@0 | 337 | * a <code>String</code> containing the local part of the name. |
aoqi@0 | 338 | * @param prefix |
aoqi@0 | 339 | * a <code>String</code> containing the prefix for the name. |
aoqi@0 | 340 | * |
aoqi@0 | 341 | * @return a <code>QName</code> with the specified <code>localName</code> |
aoqi@0 | 342 | * and <code>prefix</code>, and with a namespace that is associated |
aoqi@0 | 343 | * with the <code>prefix</code> in the context of this |
aoqi@0 | 344 | * <code>SOAPElement</code>. This namespace will be the same as |
aoqi@0 | 345 | * the one that would be returned by |
aoqi@0 | 346 | * <code>{@link #getNamespaceURI(String)}</code> if it were given |
aoqi@0 | 347 | * <code>prefix</code> as it's parameter. |
aoqi@0 | 348 | * |
aoqi@0 | 349 | * @exception SOAPException if the <code>QName</code> cannot be created. |
aoqi@0 | 350 | * |
aoqi@0 | 351 | * @since SAAJ 1.3 |
aoqi@0 | 352 | */ |
aoqi@0 | 353 | public QName createQName(String localName, String prefix) |
aoqi@0 | 354 | throws SOAPException; |
aoqi@0 | 355 | /** |
aoqi@0 | 356 | * Returns the name of this <code>SOAPElement</code> object. |
aoqi@0 | 357 | * |
aoqi@0 | 358 | * @return a <code>Name</code> object with the name of this |
aoqi@0 | 359 | * <code>SOAPElement</code> object |
aoqi@0 | 360 | */ |
aoqi@0 | 361 | public Name getElementName(); |
aoqi@0 | 362 | |
aoqi@0 | 363 | /** |
aoqi@0 | 364 | * Returns the qname of this <code>SOAPElement</code> object. |
aoqi@0 | 365 | * |
aoqi@0 | 366 | * @return a <code>QName</code> object with the qname of this |
aoqi@0 | 367 | * <code>SOAPElement</code> object |
aoqi@0 | 368 | * @see SOAPElement#getElementName() |
aoqi@0 | 369 | * @since SAAJ 1.3 |
aoqi@0 | 370 | */ |
aoqi@0 | 371 | public QName getElementQName(); |
aoqi@0 | 372 | |
aoqi@0 | 373 | /** |
aoqi@0 | 374 | * Changes the name of this <code>Element</code> to <code>newName</code> if |
aoqi@0 | 375 | * possible. SOAP Defined elements such as SOAPEnvelope, SOAPHeader, SOAPBody |
aoqi@0 | 376 | * etc. cannot have their names changed using this method. Any attempt to do |
aoqi@0 | 377 | * so will result in a SOAPException being thrown. |
aoqi@0 | 378 | *<P> |
aoqi@0 | 379 | * Callers should not rely on the element instance being renamed as is. |
aoqi@0 | 380 | * Implementations could end up copying the content of the |
aoqi@0 | 381 | * <code>SOAPElement</code> to a renamed instance. |
aoqi@0 | 382 | * |
aoqi@0 | 383 | * @param newName the new name for the <code>Element</code>. |
aoqi@0 | 384 | * |
aoqi@0 | 385 | * @exception SOAPException if changing the name of this <code>Element</code> |
aoqi@0 | 386 | * is not allowed. |
aoqi@0 | 387 | * @return The renamed Node |
aoqi@0 | 388 | * |
aoqi@0 | 389 | * @since SAAJ 1.3 |
aoqi@0 | 390 | */ |
aoqi@0 | 391 | public SOAPElement setElementQName(QName newName) throws SOAPException; |
aoqi@0 | 392 | |
aoqi@0 | 393 | /** |
aoqi@0 | 394 | * Removes the attribute with the specified name. |
aoqi@0 | 395 | * |
aoqi@0 | 396 | * @param name the <code>Name</code> object with the name of the |
aoqi@0 | 397 | * attribute to be removed |
aoqi@0 | 398 | * @return <code>true</code> if the attribute was |
aoqi@0 | 399 | * removed successfully; <code>false</code> if it was not |
aoqi@0 | 400 | * @see SOAPElement#removeAttribute(javax.xml.namespace.QName) |
aoqi@0 | 401 | */ |
aoqi@0 | 402 | public boolean removeAttribute(Name name); |
aoqi@0 | 403 | |
aoqi@0 | 404 | /** |
aoqi@0 | 405 | * Removes the attribute with the specified qname. |
aoqi@0 | 406 | * |
aoqi@0 | 407 | * @param qname the <code>QName</code> object with the qname of the |
aoqi@0 | 408 | * attribute to be removed |
aoqi@0 | 409 | * @return <code>true</code> if the attribute was |
aoqi@0 | 410 | * removed successfully; <code>false</code> if it was not |
aoqi@0 | 411 | * @see SOAPElement#removeAttribute(Name) |
aoqi@0 | 412 | * @since SAAJ 1.3 |
aoqi@0 | 413 | */ |
aoqi@0 | 414 | public boolean removeAttribute(QName qname); |
aoqi@0 | 415 | |
aoqi@0 | 416 | /** |
aoqi@0 | 417 | * Removes the namespace declaration corresponding to the given prefix. |
aoqi@0 | 418 | * |
aoqi@0 | 419 | * @param prefix a <code>String</code> giving the prefix for which |
aoqi@0 | 420 | * to search |
aoqi@0 | 421 | * @return <code>true</code> if the namespace declaration was |
aoqi@0 | 422 | * removed successfully; <code>false</code> if it was not |
aoqi@0 | 423 | */ |
aoqi@0 | 424 | public boolean removeNamespaceDeclaration(String prefix); |
aoqi@0 | 425 | |
aoqi@0 | 426 | /** |
aoqi@0 | 427 | * Returns an <code>Iterator</code> over all the immediate child |
aoqi@0 | 428 | * {@link Node}s of this element. This includes <code>javax.xml.soap.Text</code> |
aoqi@0 | 429 | * objects as well as <code>SOAPElement</code> objects. |
aoqi@0 | 430 | * <p> |
aoqi@0 | 431 | * Calling this method may cause child <code>Element</code>, |
aoqi@0 | 432 | * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be |
aoqi@0 | 433 | * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>, |
aoqi@0 | 434 | * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as |
aoqi@0 | 435 | * appropriate for the type of this parent node. As a result the calling |
aoqi@0 | 436 | * application must treat any existing references to these child nodes that |
aoqi@0 | 437 | * have been obtained through DOM APIs as invalid and either discard them or |
aoqi@0 | 438 | * refresh them with the values returned by this <code>Iterator</code>. This |
aoqi@0 | 439 | * behavior can be avoided by calling the equivalent DOM APIs. See |
aoqi@0 | 440 | * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>} |
aoqi@0 | 441 | * for more details. |
aoqi@0 | 442 | * |
aoqi@0 | 443 | * @return an iterator with the content of this <code>SOAPElement</code> |
aoqi@0 | 444 | * object |
aoqi@0 | 445 | */ |
aoqi@0 | 446 | public Iterator getChildElements(); |
aoqi@0 | 447 | |
aoqi@0 | 448 | /** |
aoqi@0 | 449 | * Returns an <code>Iterator</code> over all the immediate child |
aoqi@0 | 450 | * {@link Node}s of this element with the specified name. All of these |
aoqi@0 | 451 | * children will be <code>SOAPElement</code> nodes. |
aoqi@0 | 452 | * <p> |
aoqi@0 | 453 | * Calling this method may cause child <code>Element</code>, |
aoqi@0 | 454 | * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be |
aoqi@0 | 455 | * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>, |
aoqi@0 | 456 | * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as |
aoqi@0 | 457 | * appropriate for the type of this parent node. As a result the calling |
aoqi@0 | 458 | * application must treat any existing references to these child nodes that |
aoqi@0 | 459 | * have been obtained through DOM APIs as invalid and either discard them or |
aoqi@0 | 460 | * refresh them with the values returned by this <code>Iterator</code>. This |
aoqi@0 | 461 | * behavior can be avoided by calling the equivalent DOM APIs. See |
aoqi@0 | 462 | * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>} |
aoqi@0 | 463 | * for more details. |
aoqi@0 | 464 | * |
aoqi@0 | 465 | * @param name a <code>Name</code> object with the name of the child |
aoqi@0 | 466 | * elements to be returned |
aoqi@0 | 467 | * |
aoqi@0 | 468 | * @return an <code>Iterator</code> object over all the elements |
aoqi@0 | 469 | * in this <code>SOAPElement</code> object with the |
aoqi@0 | 470 | * specified name |
aoqi@0 | 471 | * @see SOAPElement#getChildElements(javax.xml.namespace.QName) |
aoqi@0 | 472 | */ |
aoqi@0 | 473 | public Iterator getChildElements(Name name); |
aoqi@0 | 474 | |
aoqi@0 | 475 | /** |
aoqi@0 | 476 | * Returns an <code>Iterator</code> over all the immediate child |
aoqi@0 | 477 | * {@link Node}s of this element with the specified qname. All of these |
aoqi@0 | 478 | * children will be <code>SOAPElement</code> nodes. |
aoqi@0 | 479 | * <p> |
aoqi@0 | 480 | * Calling this method may cause child <code>Element</code>, |
aoqi@0 | 481 | * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be |
aoqi@0 | 482 | * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>, |
aoqi@0 | 483 | * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as |
aoqi@0 | 484 | * appropriate for the type of this parent node. As a result the calling |
aoqi@0 | 485 | * application must treat any existing references to these child nodes that |
aoqi@0 | 486 | * have been obtained through DOM APIs as invalid and either discard them or |
aoqi@0 | 487 | * refresh them with the values returned by this <code>Iterator</code>. This |
aoqi@0 | 488 | * behavior can be avoided by calling the equivalent DOM APIs. See |
aoqi@0 | 489 | * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>} |
aoqi@0 | 490 | * for more details. |
aoqi@0 | 491 | * |
aoqi@0 | 492 | * @param qname a <code>QName</code> object with the qname of the child |
aoqi@0 | 493 | * elements to be returned |
aoqi@0 | 494 | * |
aoqi@0 | 495 | * @return an <code>Iterator</code> object over all the elements |
aoqi@0 | 496 | * in this <code>SOAPElement</code> object with the |
aoqi@0 | 497 | * specified qname |
aoqi@0 | 498 | * @see SOAPElement#getChildElements(Name) |
aoqi@0 | 499 | * @since SAAJ 1.3 |
aoqi@0 | 500 | */ |
aoqi@0 | 501 | public Iterator getChildElements(QName qname); |
aoqi@0 | 502 | |
aoqi@0 | 503 | /** |
aoqi@0 | 504 | * Sets the encoding style for this <code>SOAPElement</code> object |
aoqi@0 | 505 | * to one specified. |
aoqi@0 | 506 | * |
aoqi@0 | 507 | * @param encodingStyle a <code>String</code> giving the encoding style |
aoqi@0 | 508 | * |
aoqi@0 | 509 | * @exception IllegalArgumentException if there was a problem in the |
aoqi@0 | 510 | * encoding style being set. |
aoqi@0 | 511 | * @exception SOAPException if setting the encodingStyle is invalid for this SOAPElement. |
aoqi@0 | 512 | * @see #getEncodingStyle |
aoqi@0 | 513 | */ |
aoqi@0 | 514 | public void setEncodingStyle(String encodingStyle) |
aoqi@0 | 515 | throws SOAPException; |
aoqi@0 | 516 | /** |
aoqi@0 | 517 | * Returns the encoding style for this <code>SOAPElement</code> object. |
aoqi@0 | 518 | * |
aoqi@0 | 519 | * @return a <code>String</code> giving the encoding style |
aoqi@0 | 520 | * |
aoqi@0 | 521 | * @see #setEncodingStyle |
aoqi@0 | 522 | */ |
aoqi@0 | 523 | public String getEncodingStyle(); |
aoqi@0 | 524 | } |