src/share/jaxws_classes/javax/xml/soap/SOAPElementFactory.java

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 368
0989ad8c0860
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

     1 /*
     2  * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package javax.xml.soap;
    28 /**
    29  * <code>SOAPElementFactory</code> is a factory for XML fragments that
    30  * will eventually end up in the SOAP part. These fragments
    31  * can be inserted as children of the <code>SOAPHeader</code> or
    32  * <code>SOAPBody</code> or <code>SOAPEnvelope</code>.
    33  *
    34  * <p>Elements created using this factory do not have the properties
    35  * of an element that lives inside a SOAP header document. These
    36  * elements are copied into the XML document tree when they are
    37  * inserted.
    38  * @deprecated - Use <code>javax.xml.soap.SOAPFactory</code> for creating SOAPElements.
    39  * @see javax.xml.soap.SOAPFactory
    40  */
    41 public class SOAPElementFactory {
    43     private SOAPFactory soapFactory;
    45     private SOAPElementFactory(SOAPFactory soapFactory) {
    46         this.soapFactory = soapFactory;
    47     }
    49     /**
    50      * Create a <code>SOAPElement</code> object initialized with the
    51      * given <code>Name</code> object.
    52      *
    53      * @param name a <code>Name</code> object with the XML name for
    54      *             the new element
    55      *
    56      * @return the new <code>SOAPElement</code> object that was
    57      *         created
    58      *
    59      * @exception SOAPException if there is an error in creating the
    60      *            <code>SOAPElement</code> object
    61      *
    62      * @deprecated Use
    63      * javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name)
    64      * instead
    65      *
    66      * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.soap.Name)
    67      * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.namespace.QName)
    68      */
    69     public SOAPElement create(Name name) throws SOAPException {
    70         return soapFactory.createElement(name);
    71     }
    73     /**
    74      * Create a <code>SOAPElement</code> object initialized with the
    75      * given local name.
    76      *
    77      * @param localName a <code>String</code> giving the local name for
    78      *             the new element
    79      *
    80      * @return the new <code>SOAPElement</code> object that was
    81      *         created
    82      *
    83      * @exception SOAPException if there is an error in creating the
    84      *            <code>SOAPElement</code> object
    85      *
    86      * @deprecated Use
    87      * javax.xml.soap.SOAPFactory.createElement(String localName) instead
    88      *
    89      * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String)
    90      */
    91     public SOAPElement create(String localName) throws SOAPException {
    92         return soapFactory.createElement(localName);
    93     }
    95     /**
    96      * Create a new <code>SOAPElement</code> object with the given
    97      * local name, prefix and uri.
    98      *
    99      * @param localName a <code>String</code> giving the local name
   100      *                  for the new element
   101      * @param prefix the prefix for this <code>SOAPElement</code>
   102      * @param uri a <code>String</code> giving the URI of the
   103      *            namespace to which the new element belongs
   104      *
   105      * @exception SOAPException if there is an error in creating the
   106      *            <code>SOAPElement</code> object
   107      *
   108      * @deprecated Use
   109      * javax.xml.soap.SOAPFactory.createElement(String localName,
   110      *                      String prefix,
   111      *                      String uri)
   112      * instead
   113      *
   114      * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String)
   115      */
   116     public SOAPElement create(String localName, String prefix, String uri)
   117         throws SOAPException {
   118         return soapFactory.createElement(localName, prefix, uri);
   119     }
   121     /**
   122      * Creates a new instance of <code>SOAPElementFactory</code>.
   123      *
   124      * @return a new instance of a <code>SOAPElementFactory</code>
   125      *
   126      * @exception SOAPException if there was an error creating the
   127      *            default <code>SOAPElementFactory</code>
   128      */
   129     public static SOAPElementFactory newInstance() throws SOAPException {
   130         try {
   131             return new SOAPElementFactory(SOAPFactory.newInstance());
   132         } catch (Exception ex) {
   133             throw new SOAPException(
   134                 "Unable to create SOAP Element Factory: " + ex.getMessage());
   135         }
   136     }
   137 }

mercurial