KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > soap > SOAPElementFactory


1 /*
2  * $Id: SOAPElementFactory.java,v 1.11 2005/04/05 22:42:05 mk125090 Exp $
3  * $Revision: 1.11 $
4  * $Date: 2005/04/05 22:42:05 $
5  */

6
7 /*
8  * The contents of this file are subject to the terms
9  * of the Common Development and Distribution License
10  * (the License). You may not use this file except in
11  * compliance with the License.
12  *
13  * You can obtain a copy of the license at
14  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
15  * See the License for the specific language governing
16  * permissions and limitations under the License.
17  *
18  * When distributing Covered Code, include this CDDL
19  * Header Notice in each file and include the License file
20  * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
21  * If applicable, add the following below the CDDL Header,
22  * with the fields enclosed by brackets [] replaced by
23  * you own identifying information:
24  * "Portions Copyrighted [year] [name of copyright owner]"
25  *
26  * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
27  */

28
29 package javax.xml.soap;
30
31 /**
32  * <code>SOAPElementFactory</code> is a factory for XML fragments that
33  * will eventually end up in the SOAP part. These fragments
34  * can be inserted as children of the <code>SOAPHeader</code> or
35  * <code>SOAPBody</code> or <code>SOAPEnvelope</code>.
36  *
37  * <p>Elements created using this factory do not have the properties
38  * of an element that lives inside a SOAP header document. These
39  * elements are copied into the XML document tree when they are
40  * inserted.
41  * @deprecated - Use <code>javax.xml.soap.SOAPFactory</code> for creating SOAPElements.
42  * @see javax.xml.soap.SOAPFactory
43  */

44 public class SOAPElementFactory {
45
46     private SOAPFactory JavaDoc soapFactory;
47
48     private SOAPElementFactory(SOAPFactory JavaDoc soapFactory) {
49         this.soapFactory = soapFactory;
50     }
51
52     /**
53      * Create a <code>SOAPElement</code> object initialized with the
54      * given <code>Name</code> object.
55      *
56      * @param name a <code>Name</code> object with the XML name for
57      * the new element
58      *
59      * @return the new <code>SOAPElement</code> object that was
60      * created
61      *
62      * @exception SOAPException if there is an error in creating the
63      * <code>SOAPElement</code> object
64      *
65      * @deprecated Use
66      * javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name)
67      * instead
68      *
69      * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.soap.Name)
70      * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.namespace.QName)
71      */

72     public SOAPElement JavaDoc create(Name JavaDoc name) throws SOAPException JavaDoc {
73         return soapFactory.createElement(name);
74     }
75
76     /**
77      * Create a <code>SOAPElement</code> object initialized with the
78      * given local name.
79      *
80      * @param localName a <code>String</code> giving the local name for
81      * the new element
82      *
83      * @return the new <code>SOAPElement</code> object that was
84      * created
85      *
86      * @exception SOAPException if there is an error in creating the
87      * <code>SOAPElement</code> object
88      *
89      * @deprecated Use
90      * javax.xml.soap.SOAPFactory.createElement(String localName) instead
91      *
92      * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String)
93      */

94     public SOAPElement JavaDoc create(String JavaDoc localName) throws SOAPException JavaDoc {
95         return soapFactory.createElement(localName);
96     }
97
98     /**
99      * Create a new <code>SOAPElement</code> object with the given
100      * local name, prefix and uri.
101      *
102      * @param localName a <code>String</code> giving the local name
103      * for the new element
104      * @param prefix the prefix for this <code>SOAPElement</code>
105      * @param uri a <code>String</code> giving the URI of the
106      * namespace to which the new element belongs
107      *
108      * @exception SOAPException if there is an error in creating the
109      * <code>SOAPElement</code> object
110      *
111      * @deprecated Use
112      * javax.xml.soap.SOAPFactory.createElement(String localName,
113      * String prefix,
114      * String uri)
115      * instead
116      *
117      * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String)
118      */

119     public SOAPElement JavaDoc create(String JavaDoc localName, String JavaDoc prefix, String JavaDoc uri)
120         throws SOAPException JavaDoc {
121         return soapFactory.createElement(localName, prefix, uri);
122     }
123
124     /**
125      * Creates a new instance of <code>SOAPElementFactory</code>.
126      *
127      * @return a new instance of a <code>SOAPElementFactory</code>
128      *
129      * @exception SOAPException if there was an error creating the
130      * default <code>SOAPElementFactory</code>
131      */

132     public static SOAPElementFactory JavaDoc newInstance() throws SOAPException JavaDoc {
133         try {
134             return new SOAPElementFactory JavaDoc(SOAPFactory.newInstance());
135         } catch (Exception JavaDoc ex) {
136             throw new SOAPException JavaDoc(
137                 "Unable to create SOAP Element Factory: " + ex.getMessage());
138         }
139     }
140 }
141
Popular Tags