/** * Create a new instance of the factory. If the classLoader argument is null, then the * ContextClassLoader is used. * * <p>Note that this is a new method that replaces the deprecated newInstance(String factoryId, * ClassLoader classLoader) method. No changes in behavior are defined by this replacement method * relative to the deprecated method. * * @param factoryId Name of the factory to find, same as a property name * @param classLoader classLoader to use * @return the factory implementation * @throws FactoryConfigurationError if an instance of this factory cannot be loaded */ public static XMLInputFactory newFactory(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError { try { // do not fallback if given classloader can't find the class, throw exception return (XMLInputFactory) FactoryFinder.find(factoryId, classLoader, null); } catch (FactoryFinder.ConfigurationError e) { throw new FactoryConfigurationError(e.getException(), e.getMessage()); } }
/* */ public static DocumentBuilderFactory newInstance( String factoryClassName, ClassLoader classLoader) /* */ { /* */ try /* */ { /* 170 */ return (DocumentBuilderFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); /* */ } catch (FactoryFinder.ConfigurationError e) { /* 172 */ throw new FactoryConfigurationError(e.getException(), e.getMessage()); /* */ } /* */ }
/* */ public static DatatypeFactory newInstance( String factoryClassName, ClassLoader classLoader) /* */ throws DatatypeConfigurationException /* */ { /* */ try /* */ { /* 176 */ return (DatatypeFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); /* */ } catch (FactoryFinder.ConfigurationError e) { /* 178 */ throw new DatatypeConfigurationException(e.getMessage(), e.getException()); /* */ } /* */ }
/* */ public static DocumentBuilderFactory newInstance() /* */ { /* */ try /* */ { /* 121 */ return (DocumentBuilderFactory) FactoryFinder.find( "javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); /* */ } /* */ catch (FactoryFinder.ConfigurationError e) /* */ { /* 127 */ throw new FactoryConfigurationError(e.getException(), e.getMessage()); /* */ } /* */ }
/* */ public static DatatypeFactory newInstance() /* */ throws DatatypeConfigurationException /* */ { /* */ try /* */ { /* 129 */ return (DatatypeFactory) FactoryFinder.find( "javax.xml.datatype.DatatypeFactory", DATATYPEFACTORY_IMPLEMENTATION_CLASS); /* */ } /* */ catch (FactoryFinder.ConfigurationError e) /* */ { /* 135 */ throw new DatatypeConfigurationException(e.getMessage(), e.getException()); /* */ } /* */ }