172 * <p> 173 * Use the service-provider loading facility, defined by the 174 * {@link java.util.ServiceLoader} class, to attempt to locate and load an 175 * implementation of the service using the {@linkplain 176 * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}: 177 * the service-provider loading facility will use the {@linkplain 178 * java.lang.Thread#getContextClassLoader() current thread's context class loader} 179 * to attempt to load the service. If the context class 180 * loader is null, the {@linkplain 181 * ClassLoader#getSystemClassLoader() system class loader} will be used. 182 * </li> 183 * <li> 184 * <p> 185 * Otherwise, the {@linkplain #newDefaultFactory() system-default} 186 * implementation is returned. 187 * </li> 188 * </ul> 189 * <p> 190 * Once an application has obtained a reference to a XMLOutputFactory it 191 * can use the factory to configure and obtain stream instances. 192 * <p> 193 * Note that this is a new method that replaces the deprecated newInstance() method. 194 * No changes in behavior are defined by this replacement method relative to the 195 * deprecated method. 196 * 197 * @throws FactoryConfigurationError in case of {@linkplain 198 * java.util.ServiceConfigurationError service configuration error} or if 199 * the implementation is not available or cannot be instantiated. 200 */ 201 public static XMLOutputFactory newFactory() 202 throws FactoryConfigurationError 203 { 204 return FactoryFinder.find(XMLOutputFactory.class, DEFAULIMPL); 205 } 206 207 /** 208 * Create a new instance of the factory. 209 * 210 * @param factoryId Name of the factory to find, same as 211 * a property name 212 * @param classLoader classLoader to use 213 * @return the factory implementation 214 * @throws FactoryConfigurationError if an instance of this factory cannot be loaded 215 * | 172 * <p> 173 * Use the service-provider loading facility, defined by the 174 * {@link java.util.ServiceLoader} class, to attempt to locate and load an 175 * implementation of the service using the {@linkplain 176 * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}: 177 * the service-provider loading facility will use the {@linkplain 178 * java.lang.Thread#getContextClassLoader() current thread's context class loader} 179 * to attempt to load the service. If the context class 180 * loader is null, the {@linkplain 181 * ClassLoader#getSystemClassLoader() system class loader} will be used. 182 * </li> 183 * <li> 184 * <p> 185 * Otherwise, the {@linkplain #newDefaultFactory() system-default} 186 * implementation is returned. 187 * </li> 188 * </ul> 189 * <p> 190 * Once an application has obtained a reference to a XMLOutputFactory it 191 * can use the factory to configure and obtain stream instances. 192 * 193 * @throws FactoryConfigurationError in case of {@linkplain 194 * java.util.ServiceConfigurationError service configuration error} or if 195 * the implementation is not available or cannot be instantiated. 196 */ 197 public static XMLOutputFactory newFactory() 198 throws FactoryConfigurationError 199 { 200 return FactoryFinder.find(XMLOutputFactory.class, DEFAULIMPL); 201 } 202 203 /** 204 * Create a new instance of the factory. 205 * 206 * @param factoryId Name of the factory to find, same as 207 * a property name 208 * @param classLoader classLoader to use 209 * @return the factory implementation 210 * @throws FactoryConfigurationError if an instance of this factory cannot be loaded 211 * |