< prev index next >

src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java

Print this page


   1 /*

   2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.  Oracle designates this
   7  * particular file as subject to the "Classpath" exception as provided
   8  * by Oracle in the LICENSE file that accompanied this code.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 /*
  26  * Copyright (c) 2009, 2013, by Oracle Corporation. All Rights Reserved.
  27  */
  28 
  29 package javax.xml.stream;
  30 
  31 import com.sun.xml.internal.stream.XMLOutputFactoryImpl;
  32 import javax.xml.transform.Result;
  33 
  34 /**
  35  * Defines an abstract implementation of a factory for
  36  * getting XMLEventWriters and XMLStreamWriters.
  37  *
  38  * The following table defines the standard properties of this specification.
  39  * Each property varies in the level of support required by each implementation.
  40  * The level of support required is described in the 'Required' column.
  41  *
  42  *     <table border="2" rules="all" cellpadding="4">
  43  *     <thead>
  44  *      <tr>
  45  *        <th align="center" colspan="2">
  46  *          Configuration parameters
  47  *        </th>
  48  *      </tr>


 208   public static XMLOutputFactory newFactory()
 209     throws FactoryConfigurationError
 210   {
 211     return FactoryFinder.find(XMLOutputFactory.class, DEFAULIMPL);
 212   }
 213 
 214   /**
 215    * Create a new instance of the factory.
 216    *
 217    * @param factoryId             Name of the factory to find, same as
 218    *                              a property name
 219    * @param classLoader           classLoader to use
 220    * @return the factory implementation
 221    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
 222    *
 223    * @deprecated  This method has been deprecated because it returns an
 224    *              instance of XMLInputFactory, which is of the wrong class.
 225    *              Use the new method {@link #newFactory(java.lang.String,
 226    *              java.lang.ClassLoader)} instead.
 227    */

 228   public static XMLInputFactory newInstance(String factoryId,
 229           ClassLoader classLoader)
 230           throws FactoryConfigurationError {
 231       //do not fallback if given classloader can't find the class, throw exception
 232       return FactoryFinder.find(XMLInputFactory.class, factoryId, classLoader, null);
 233   }
 234 
 235   /**
 236    * Create a new instance of the factory.
 237    * If the classLoader argument is null, then the ContextClassLoader is used.
 238    * <p>
 239    * This method uses the following ordered lookup procedure to determine
 240    * the XMLOutputFactory implementation class to load:
 241    * <ul>
 242    * <li>
 243    *   Use the value of the system property identified by {@code factoryId}.
 244    * </li>
 245    * <li>
 246    *   <p>
 247    *   Use the configuration file "stax.properties". The file is in standard


   1 /*
   2  * Copyright (c) 2009, 2016, 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  */
  25 




  26 package javax.xml.stream;
  27 
  28 import com.sun.xml.internal.stream.XMLOutputFactoryImpl;
  29 import javax.xml.transform.Result;
  30 
  31 /**
  32  * Defines an abstract implementation of a factory for
  33  * getting XMLEventWriters and XMLStreamWriters.
  34  *
  35  * The following table defines the standard properties of this specification.
  36  * Each property varies in the level of support required by each implementation.
  37  * The level of support required is described in the 'Required' column.
  38  *
  39  *     <table border="2" rules="all" cellpadding="4">
  40  *     <thead>
  41  *      <tr>
  42  *        <th align="center" colspan="2">
  43  *          Configuration parameters
  44  *        </th>
  45  *      </tr>


 205   public static XMLOutputFactory newFactory()
 206     throws FactoryConfigurationError
 207   {
 208     return FactoryFinder.find(XMLOutputFactory.class, DEFAULIMPL);
 209   }
 210 
 211   /**
 212    * Create a new instance of the factory.
 213    *
 214    * @param factoryId             Name of the factory to find, same as
 215    *                              a property name
 216    * @param classLoader           classLoader to use
 217    * @return the factory implementation
 218    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
 219    *
 220    * @deprecated  This method has been deprecated because it returns an
 221    *              instance of XMLInputFactory, which is of the wrong class.
 222    *              Use the new method {@link #newFactory(java.lang.String,
 223    *              java.lang.ClassLoader)} instead.
 224    */
 225   @Deprecated(since="7")
 226   public static XMLInputFactory newInstance(String factoryId,
 227           ClassLoader classLoader)
 228           throws FactoryConfigurationError {
 229       //do not fallback if given classloader can't find the class, throw exception
 230       return FactoryFinder.find(XMLInputFactory.class, factoryId, classLoader, null);
 231   }
 232 
 233   /**
 234    * Create a new instance of the factory.
 235    * If the classLoader argument is null, then the ContextClassLoader is used.
 236    * <p>
 237    * This method uses the following ordered lookup procedure to determine
 238    * the XMLOutputFactory implementation class to load:
 239    * <ul>
 240    * <li>
 241    *   Use the value of the system property identified by {@code factoryId}.
 242    * </li>
 243    * <li>
 244    *   <p>
 245    *   Use the configuration file "stax.properties". The file is in standard


< prev index next >