ohair@286: /* alanb@368: * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. ohair@286: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@286: * ohair@286: * This code is free software; you can redistribute it and/or modify it ohair@286: * under the terms of the GNU General Public License version 2 only, as ohair@286: * published by the Free Software Foundation. Oracle designates this ohair@286: * particular file as subject to the "Classpath" exception as provided ohair@286: * by Oracle in the LICENSE file that accompanied this code. ohair@286: * ohair@286: * This code is distributed in the hope that it will be useful, but WITHOUT ohair@286: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@286: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@286: * version 2 for more details (a copy is included in the LICENSE file that ohair@286: * accompanied this code). ohair@286: * ohair@286: * You should have received a copy of the GNU General Public License version ohair@286: * 2 along with this work; if not, write to the Free Software Foundation, ohair@286: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@286: * ohair@286: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@286: * or visit www.oracle.com if you need additional information or have any ohair@286: * questions. ohair@286: */ ohair@286: ohair@286: package javax.xml.soap; ohair@286: ohair@286: /** ohair@286: * SOAPElementFactory is a factory for XML fragments that ohair@286: * will eventually end up in the SOAP part. These fragments ohair@286: * can be inserted as children of the SOAPHeader or ohair@286: * SOAPBody or SOAPEnvelope. ohair@286: * ohair@286: *

Elements created using this factory do not have the properties ohair@286: * of an element that lives inside a SOAP header document. These ohair@286: * elements are copied into the XML document tree when they are ohair@286: * inserted. ohair@286: * @deprecated - Use javax.xml.soap.SOAPFactory for creating SOAPElements. ohair@286: * @see javax.xml.soap.SOAPFactory ohair@286: */ ohair@286: public class SOAPElementFactory { ohair@286: ohair@286: private SOAPFactory soapFactory; ohair@286: ohair@286: private SOAPElementFactory(SOAPFactory soapFactory) { ohair@286: this.soapFactory = soapFactory; ohair@286: } ohair@286: ohair@286: /** ohair@286: * Create a SOAPElement object initialized with the ohair@286: * given Name object. ohair@286: * ohair@286: * @param name a Name object with the XML name for ohair@286: * the new element ohair@286: * ohair@286: * @return the new SOAPElement object that was ohair@286: * created ohair@286: * ohair@286: * @exception SOAPException if there is an error in creating the ohair@286: * SOAPElement object ohair@286: * ohair@286: * @deprecated Use ohair@286: * javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name) ohair@286: * instead ohair@286: * ohair@286: * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.soap.Name) ohair@286: * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.namespace.QName) ohair@286: */ ohair@286: public SOAPElement create(Name name) throws SOAPException { ohair@286: return soapFactory.createElement(name); ohair@286: } ohair@286: ohair@286: /** ohair@286: * Create a SOAPElement object initialized with the ohair@286: * given local name. ohair@286: * ohair@286: * @param localName a String giving the local name for ohair@286: * the new element ohair@286: * ohair@286: * @return the new SOAPElement object that was ohair@286: * created ohair@286: * ohair@286: * @exception SOAPException if there is an error in creating the ohair@286: * SOAPElement object ohair@286: * ohair@286: * @deprecated Use ohair@286: * javax.xml.soap.SOAPFactory.createElement(String localName) instead ohair@286: * ohair@286: * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String) ohair@286: */ ohair@286: public SOAPElement create(String localName) throws SOAPException { ohair@286: return soapFactory.createElement(localName); ohair@286: } ohair@286: ohair@286: /** ohair@286: * Create a new SOAPElement object with the given ohair@286: * local name, prefix and uri. ohair@286: * ohair@286: * @param localName a String giving the local name ohair@286: * for the new element ohair@286: * @param prefix the prefix for this SOAPElement ohair@286: * @param uri a String giving the URI of the ohair@286: * namespace to which the new element belongs ohair@286: * ohair@286: * @exception SOAPException if there is an error in creating the ohair@286: * SOAPElement object ohair@286: * ohair@286: * @deprecated Use ohair@286: * javax.xml.soap.SOAPFactory.createElement(String localName, ohair@286: * String prefix, ohair@286: * String uri) ohair@286: * instead ohair@286: * ohair@286: * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String) ohair@286: */ ohair@286: public SOAPElement create(String localName, String prefix, String uri) ohair@286: throws SOAPException { ohair@286: return soapFactory.createElement(localName, prefix, uri); ohair@286: } ohair@286: ohair@286: /** ohair@286: * Creates a new instance of SOAPElementFactory. ohair@286: * ohair@286: * @return a new instance of a SOAPElementFactory ohair@286: * ohair@286: * @exception SOAPException if there was an error creating the ohair@286: * default SOAPElementFactory ohair@286: */ ohair@286: public static SOAPElementFactory newInstance() throws SOAPException { ohair@286: try { ohair@286: return new SOAPElementFactory(SOAPFactory.newInstance()); ohair@286: } catch (Exception ex) { ohair@286: throw new SOAPException( ohair@286: "Unable to create SOAP Element Factory: " + ex.getMessage()); ohair@286: } ohair@286: } ohair@286: }