Source Code Cross Referenced for SOAPElement.java in  » 6.0-JDK-Core » xml » javax » xml » soap » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » javax.xml.soap 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * $Id: SOAPElement.java,v 1.18 2005/12/07 07:25:37 vj135062 Exp $
003         * $Revision: 1.18 $
004         * $Date: 2005/12/07 07:25:37 $
005         */
006
007        /*
008         * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
009         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
010         *
011         * This code is free software; you can redistribute it and/or modify it
012         * under the terms of the GNU General Public License version 2 only, as
013         * published by the Free Software Foundation.  Sun designates this
014         * particular file as subject to the "Classpath" exception as provided
015         * by Sun in the LICENSE file that accompanied this code.
016         *
017         * This code is distributed in the hope that it will be useful, but WITHOUT
018         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
019         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
020         * version 2 for more details (a copy is included in the LICENSE file that
021         * accompanied this code).
022         *
023         * You should have received a copy of the GNU General Public License version
024         * 2 along with this work; if not, write to the Free Software Foundation,
025         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
026         *
027         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
028         * CA 95054 USA or visit www.sun.com if you need additional information or
029         * have any questions.
030         */
031        package javax.xml.soap;
032
033        import java.util.Iterator;
034
035        import javax.xml.namespace.QName;
036
037        /**
038         * An object representing an element of a SOAP message that is allowed but not
039         * specifically prescribed by a SOAP specification. This interface serves as the
040         * base interface for those objects that are specifically prescribed by a SOAP
041         * specification.
042         * <p>
043         * Methods in this interface that are required to return SAAJ specific objects
044         * may "silently" replace nodes in the tree as required to successfully return
045         * objects of the correct type. See {@link #getChildElements()} and 
046         * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>}
047         * for details.
048         */
049        public interface SOAPElement extends Node, org.w3c.dom.Element {
050
051            /**
052             * Creates a new <code>SOAPElement</code> object initialized with the
053             * given <code>Name</code> object and adds the new element to this
054             * <code>SOAPElement</code> object.
055             * <P>
056             * This method may be deprecated in a future release of SAAJ in favor of 
057             * addChildElement(javax.xml.namespace.QName)
058             *
059             * @param name a <code>Name</code> object with the XML name for the
060             *        new element
061             *
062             * @return the new <code>SOAPElement</code> object that was created
063             * @exception SOAPException if there is an error in creating the
064             *                          <code>SOAPElement</code> object
065             * @see SOAPElement#addChildElement(javax.xml.namespace.QName)
066             */
067            public SOAPElement addChildElement(Name name) throws SOAPException;
068
069            /**
070             * Creates a new <code>SOAPElement</code> object initialized with the given 
071             * <code>QName</code> object and adds the new element to this <code>SOAPElement</code>
072             *  object. The  <i>namespace</i>, <i>localname</i> and <i>prefix</i> of the new 
073             * <code>SOAPElement</code> are all taken  from the <code>qname</code> argument.
074             * 
075             * @param qname a <code>QName</code> object with the XML name for the
076             *        new element
077             *
078             * @return the new <code>SOAPElement</code> object that was created
079             * @exception SOAPException if there is an error in creating the
080             *                          <code>SOAPElement</code> object
081             * @see SOAPElement#addChildElement(Name)
082             * @since SAAJ 1.3
083             */
084            public SOAPElement addChildElement(QName qname)
085                    throws SOAPException;
086
087            /**
088             * Creates a new <code>SOAPElement</code> object initialized with the
089             * specified local name and adds the new element to this
090             * <code>SOAPElement</code> object.  
091             * The new  <code>SOAPElement</code> inherits any in-scope default namespace.
092             *
093             * @param localName a <code>String</code> giving the local name for
094             *          the element
095             * @return the new <code>SOAPElement</code> object that was created
096             * @exception SOAPException if there is an error in creating the
097             *                          <code>SOAPElement</code> object
098             */
099            public SOAPElement addChildElement(String localName)
100                    throws SOAPException;
101
102            /**
103             * Creates a new <code>SOAPElement</code> object initialized with the
104             * specified local name and prefix and adds the new element to this
105             * <code>SOAPElement</code> object.
106             * 
107             * @param localName a <code>String</code> giving the local name for
108             *        the new element
109             * @param prefix a <code>String</code> giving the namespace prefix for
110             *        the new element
111             *
112             * @return the new <code>SOAPElement</code> object that was created
113             * @exception SOAPException if the <code>prefix</code> is not valid in the
114             *         context of this <code>SOAPElement</code> or  if there is an error in creating the
115             *                          <code>SOAPElement</code> object
116             */
117            public SOAPElement addChildElement(String localName, String prefix)
118                    throws SOAPException;
119
120            /**
121             * Creates a new <code>SOAPElement</code> object initialized with the
122             * specified local name, prefix, and URI and adds the new element to this
123             * <code>SOAPElement</code> object.
124             *
125             * @param localName a <code>String</code> giving the local name for
126             *        the new element
127             * @param prefix a <code>String</code> giving the namespace prefix for
128             *        the new element
129             * @param uri a <code>String</code> giving the URI of the namespace
130             *        to which the new element belongs
131             *
132             * @return the new <code>SOAPElement</code> object that was created
133             * @exception SOAPException if there is an error in creating the
134             *                          <code>SOAPElement</code> object
135             */
136            public SOAPElement addChildElement(String localName, String prefix,
137                    String uri) throws SOAPException;
138
139            /**
140             * Add a <code>SOAPElement</code> as a child of this
141             * <code>SOAPElement</code> instance. The <code>SOAPElement</code>
142             * is expected to be created by a
143             * <code>SOAPFactory</code>. Callers should not rely on the
144             * element instance being added as is into the XML
145             * tree. Implementations could end up copying the content
146             * of the <code>SOAPElement</code> passed into an instance of
147             * a different <code>SOAPElement</code> implementation. For
148             * instance if <code>addChildElement()</code> is called on a
149             * <code>SOAPHeader</code>, <code>element</code> will be copied
150             * into an instance of a <code>SOAPHeaderElement</code>.
151             *
152             * <P>The fragment rooted in <code>element</code> is either added
153             * as a whole or not at all, if there was an error.
154             *
155             * <P>The fragment rooted in <code>element</code> cannot contain
156             * elements named "Envelope", "Header" or "Body" and in the SOAP
157             * namespace. Any namespace prefixes present in the fragment
158             * should be fully resolved using appropriate namespace
159             * declarations within the fragment itself.
160             *
161             * @param element the <code>SOAPElement</code> to be added as a
162             *                new child
163             *
164             * @exception SOAPException if there was an error in adding this
165             *                          element as a child
166             *
167             * @return an instance representing the new SOAP element that was
168             *         actually added to the tree.
169             */
170            public SOAPElement addChildElement(SOAPElement element)
171                    throws SOAPException;
172
173            /**
174             * Detaches all children of this <code>SOAPElement</code>.
175             * <p>
176             * This method is useful for rolling back the construction of partially 
177             * completed <code>SOAPHeaders</code> and <code>SOAPBodys</code> in 
178             * preparation for sending a fault when an error condition is detected. It 
179             * is also useful for recycling portions of a document within a SOAP 
180             * message.
181             * 
182             * @since SAAJ 1.2
183             */
184            public abstract void removeContents();
185
186            /**
187             * Creates a new <code>Text</code> object initialized with the given
188             * <code>String</code> and adds it to this <code>SOAPElement</code> object.
189             *
190             * @param text a <code>String</code> object with the textual content to be added
191             *
192             * @return the <code>SOAPElement</code> object into which
193             *         the new <code>Text</code> object was inserted
194             * @exception SOAPException if there is an error in creating the
195             *                    new <code>Text</code> object or if it is not legal to
196             *                      attach it as a child to this 
197             *                      <code>SOAPElement</code>
198             */
199            public SOAPElement addTextNode(String text) throws SOAPException;
200
201            /**
202             * Adds an attribute with the specified name and value to this
203             * <code>SOAPElement</code> object.
204             *
205             * @param name a <code>Name</code> object with the name of the attribute
206             * @param value a <code>String</code> giving the value of the attribute
207             * @return the <code>SOAPElement</code> object into which the attribute was
208             *         inserted
209             *
210             * @exception SOAPException if there is an error in creating the
211             *                          Attribute, or it is invalid to set 
212                                        an attribute with <code>Name</code> 
213                                         <code>name</code> on this SOAPElement.
214             * @see SOAPElement#addAttribute(javax.xml.namespace.QName, String)
215             */
216            public SOAPElement addAttribute(Name name, String value)
217                    throws SOAPException;
218
219            /**
220             * Adds an attribute with the specified name and value to this
221             * <code>SOAPElement</code> object.
222             *
223             * @param qname a <code>QName</code> object with the name of the attribute
224             * @param value a <code>String</code> giving the value of the attribute
225             * @return the <code>SOAPElement</code> object into which the attribute was
226             *         inserted
227             *
228             * @exception SOAPException if there is an error in creating the
229             *                          Attribute, or it is invalid to set
230                                        an attribute with <code>QName</code> 
231                                        <code>qname</code> on this SOAPElement.
232             * @see SOAPElement#addAttribute(Name, String)
233             * @since SAAJ 1.3
234             */
235            public SOAPElement addAttribute(QName qname, String value)
236                    throws SOAPException;
237
238            /**
239             * Adds a namespace declaration with the specified prefix and URI to this
240             * <code>SOAPElement</code> object.
241             *
242             * @param prefix a <code>String</code> giving the prefix of the namespace
243             * @param uri a <code>String</code> giving the uri of the namespace
244             * @return the <code>SOAPElement</code> object into which this
245             *          namespace declaration was inserted.
246             *
247             * @exception SOAPException if there is an error in creating the
248             *                          namespace
249             */
250            public SOAPElement addNamespaceDeclaration(String prefix, String uri)
251                    throws SOAPException;
252
253            /**
254             * Returns the value of the attribute with the specified name.
255             *
256             * @param name a <code>Name</code> object with the name of the attribute
257             * @return a <code>String</code> giving the value of the specified
258             *         attribute, Null if there is no such attribute
259             * @see SOAPElement#getAttributeValue(javax.xml.namespace.QName)
260             */
261            public String getAttributeValue(Name name);
262
263            /**
264             * Returns the value of the attribute with the specified qname.
265             *
266             * @param qname a <code>QName</code> object with the qname of the attribute
267             * @return a <code>String</code> giving the value of the specified
268             *         attribute, Null if there is no such attribute
269             * @see SOAPElement#getAttributeValue(Name)
270             * @since SAAJ 1.3
271             */
272            public String getAttributeValue(QName qname);
273
274            /**
275             * Returns an <code>Iterator</code> over all of the attribute 
276             * <code>Name</code> objects in this
277             * <code>SOAPElement</code> object. The iterator can be used to get
278             * the attribute names, which can then be passed to the method
279             * <code>getAttributeValue</code> to retrieve the value of each
280             * attribute.
281             *
282             * @see SOAPElement#getAllAttributesAsQNames()
283             * @return an iterator over the names of the attributes
284             */
285            public Iterator getAllAttributes();
286
287            /**
288             * Returns an <code>Iterator</code> over all of the attributes
289             * in this <code>SOAPElement</code>  as <code>QName</code> objects. 
290             * The iterator can be used to get the attribute QName, which can then 
291             * be passed to the method <code>getAttributeValue</code> to retrieve 
292             * the value of each attribute.
293             *
294             * @return an iterator over the QNames of the attributes
295             * @see SOAPElement#getAllAttributes()
296             * @since SAAJ 1.3
297             */
298            public Iterator getAllAttributesAsQNames();
299
300            /**
301             * Returns the URI of the namespace that has the given prefix.
302             *
303             * @param prefix a <code>String</code> giving the prefix of the namespace
304             *        for which to search 
305             * @return a <code>String</code> with the uri of the namespace that has
306             *        the given prefix
307             */
308            public String getNamespaceURI(String prefix);
309
310            /**
311             * Returns an <code>Iterator</code> over the namespace prefix
312             * <code>String</code>s declared by this element. The prefixes returned by
313             * this iterator can be passed to the method
314             * <code>getNamespaceURI</code> to retrieve the URI of each namespace.
315             *
316             * @return an iterator over the namespace prefixes in this
317             *         <code>SOAPElement</code> object
318             */
319            public Iterator getNamespacePrefixes();
320
321            /**
322             * Returns an <code>Iterator</code> over the namespace prefix
323             * <code>String</code>s visible to this element. The prefixes returned by
324             * this iterator can be passed to the method
325             * <code>getNamespaceURI</code> to retrieve the URI of each namespace.
326             *
327             * @return an iterator over the namespace prefixes are within scope of this
328             *         <code>SOAPElement</code> object
329             * 
330             * @since SAAJ 1.2
331             */
332            public Iterator getVisibleNamespacePrefixes();
333
334            /**
335             * Creates a <code>QName</code> whose namespace URI is the one associated
336             * with the parameter, <code>prefix</code>, in the context of this
337             * <code>SOAPElement</code>. The remaining elements of the new 
338             * <code>QName</code> are taken directly from the parameters, 
339             * <code>localName</code> and <code>prefix</code>. 
340             * 
341             * @param localName
342             *          a <code>String</code> containing the local part of the name.
343             * @param prefix
344             *          a <code>String</code> containing the prefix for the name.
345             * 
346             * @return a <code>QName</code> with the specified <code>localName</code>
347             *          and <code>prefix</code>, and with a namespace that is associated
348             *          with the <code>prefix</code> in the context of this 
349             *          <code>SOAPElement</code>. This namespace will be the same as
350             *          the one that would be returned by 
351             *          <code>{@link #getNamespaceURI(String)}</code> if it were given 
352             *          <code>prefix</code> as it's parameter.
353             * 
354             * @exception SOAPException if the <code>QName</code> cannot be created.
355             * 
356             * @since SAAJ 1.3 
357             */
358            public QName createQName(String localName, String prefix)
359                    throws SOAPException;
360
361            /**
362             * Returns the name of this <code>SOAPElement</code> object.
363             *
364             * @return a <code>Name</code> object with the name of this
365             *         <code>SOAPElement</code> object
366             */
367            public Name getElementName();
368
369            /**
370             * Returns the qname of this <code>SOAPElement</code> object.
371             *
372             * @return a <code>QName</code> object with the qname of this
373             *         <code>SOAPElement</code> object
374             * @see SOAPElement#getElementName()
375             * @since SAAJ 1.3
376             */
377            public QName getElementQName();
378
379            /**
380             * Changes the name of this <code>Element</code> to <code>newName</code> if 
381             * possible. SOAP Defined elements such as SOAPEnvelope, SOAPHeader, SOAPBody 
382             * etc. cannot have their names changed using this method. Any attempt to do 
383             * so will result in a  SOAPException being thrown.
384             *<P>
385             * Callers should not rely on the element instance being renamed as is. 
386             * Implementations could end up copying the content of the 
387             * <code>SOAPElement</code> to a renamed instance.
388             * 
389             * @param newName the new name for the <code>Element</code>.
390             * 
391             * @exception SOAPException if changing the name of this <code>Element</code>
392             *                          is not allowed.
393             * @return The renamed Node
394             * 
395             * @since SAAJ 1.3
396             */
397            public SOAPElement setElementQName(QName newName)
398                    throws SOAPException;
399
400            /**
401             * Removes the attribute with the specified name.
402             *
403             * @param name the <code>Name</code> object with the name of the
404             *        attribute to be removed
405             * @return <code>true</code> if the attribute was
406             *         removed successfully; <code>false</code> if it was not
407             * @see SOAPElement#removeAttribute(javax.xml.namespace.QName)
408             */
409            public boolean removeAttribute(Name name);
410
411            /**
412             * Removes the attribute with the specified qname.
413             *
414             * @param qname the <code>QName</code> object with the qname of the
415             *        attribute to be removed
416             * @return <code>true</code> if the attribute was
417             *         removed successfully; <code>false</code> if it was not
418             * @see SOAPElement#removeAttribute(Name)
419             * @since SAAJ 1.3
420             */
421            public boolean removeAttribute(QName qname);
422
423            /**
424             * Removes the namespace declaration corresponding to the given prefix.
425             *
426             * @param prefix a <code>String</code> giving the prefix for which
427             *        to search
428             * @return <code>true</code> if the namespace declaration was
429             *         removed successfully; <code>false</code> if it was not
430             */
431            public boolean removeNamespaceDeclaration(String prefix);
432
433            /**
434             * Returns an <code>Iterator</code> over all the immediate child
435             * {@link Node}s of this element. This includes <code>javax.xml.soap.Text</code>
436             * objects as well as <code>SOAPElement</code> objects.
437             * <p>
438             * Calling this method may cause child <code>Element</code>, 
439             * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be 
440             * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>, 
441             * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as
442             * appropriate for the type of this parent node. As a result the calling 
443             * application must treat any existing references to these child nodes that 
444             * have been obtained through DOM APIs as invalid and either discard them or
445             * refresh them with the values returned by this <code>Iterator</code>. This 
446             * behavior can be avoided by calling the equivalent DOM APIs. See
447             * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>}
448             * for more details.
449             *
450             * @return an iterator with the content of this <code>SOAPElement</code>
451             *         object
452             */
453            public Iterator getChildElements();
454
455            /**
456             * Returns an <code>Iterator</code> over all the immediate child
457             * {@link Node}s of this element with the specified name. All of these 
458             * children will be <code>SOAPElement</code> nodes.
459             * <p>
460             * Calling this method may cause child <code>Element</code>, 
461             * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be 
462             * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>, 
463             * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as
464             * appropriate for the type of this parent node. As a result the calling 
465             * application must treat any existing references to these child nodes that 
466             * have been obtained through DOM APIs as invalid and either discard them or
467             * refresh them with the values returned by this <code>Iterator</code>. This 
468             * behavior can be avoided by calling the equivalent DOM APIs. See
469             * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>}
470             * for more details.
471             * 
472             * @param name a <code>Name</code> object with the name of the child
473             *        elements to be returned
474             *
475             * @return an <code>Iterator</code> object over all the elements
476             *         in this <code>SOAPElement</code> object with the
477             *         specified name
478             * @see SOAPElement#getChildElements(javax.xml.namespace.QName)
479             */
480            public Iterator getChildElements(Name name);
481
482            /**
483             * Returns an <code>Iterator</code> over all the immediate child
484             * {@link Node}s of this element with the specified qname. All of these 
485             * children will be <code>SOAPElement</code> nodes.
486             * <p>
487             * Calling this method may cause child <code>Element</code>, 
488             * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be 
489             * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>, 
490             * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as
491             * appropriate for the type of this parent node. As a result the calling 
492             * application must treat any existing references to these child nodes that 
493             * have been obtained through DOM APIs as invalid and either discard them or
494             * refresh them with the values returned by this <code>Iterator</code>. This 
495             * behavior can be avoided by calling the equivalent DOM APIs. See
496             * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>}
497             * for more details.
498             * 
499             * @param qname a <code>QName</code> object with the qname of the child
500             *        elements to be returned
501             *
502             * @return an <code>Iterator</code> object over all the elements
503             *         in this <code>SOAPElement</code> object with the
504             *         specified qname
505             * @see SOAPElement#getChildElements(Name)
506             * @since SAAJ 1.3     
507             */
508            public Iterator getChildElements(QName qname);
509
510            /**
511             * Sets the encoding style for this <code>SOAPElement</code> object
512             * to one specified.
513             *
514             * @param encodingStyle a <code>String</code> giving the encoding style
515             *
516             * @exception IllegalArgumentException if there was a problem in the
517             *            encoding style being set.
518             * @exception SOAPException if setting the encodingStyle is invalid for this SOAPElement.
519             * @see #getEncodingStyle
520             */
521            public void setEncodingStyle(String encodingStyle)
522                    throws SOAPException;
523
524            /**
525             * Returns the encoding style for this <code>SOAPElement</code> object.
526             *
527             * @return a <code>String</code> giving the encoding style
528             *
529             * @see #setEncodingStyle
530             */
531            public String getEncodingStyle();
532        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.