src/javax/xml/parsers/DocumentBuilderFactory.java

Print this page

        

*** 32,42 **** * parser that produces DOM object trees from XML documents. * * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> * @author <a href="mailto:Neeraj.Bajaj@sun.com">Neeraj Bajaj</a> * ! * @version $Revision: 1.9 $, $Date: 2010/05/25 16:19:44 $ */ public abstract class DocumentBuilderFactory { --- 32,42 ---- * parser that produces DOM object trees from XML documents. * * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> * @author <a href="mailto:Neeraj.Bajaj@sun.com">Neeraj Bajaj</a> * ! * @version $Revision: 1.10 $, $Date: 2010-11-01 04:36:09 $ */ public abstract class DocumentBuilderFactory {
*** 83,97 **** * when the first attempt is made to read from it, no further attempts are * made to check for its existence. It is not possible to change the value * of any property in jaxp.properties after it has been read for the first time. * </li> * <li> ! * Use the Services API (as detailed in the JAR specification), if ! * available, to determine the classname. The Services API will look ! * for a classname in the file ! * <code>META-INF/services/javax.xml.parsers.DocumentBuilderFactory</code> ! * in jars available to the runtime. * </li> * <li> * Platform default <code>DocumentBuilderFactory</code> instance. * </li> * </ul> --- 83,99 ---- * when the first attempt is made to read from it, no further attempts are * made to check for its existence. It is not possible to change the value * of any property in jaxp.properties after it has been read for the first time. * </li> * <li> ! * Uses the service-provider loading facilities, defined by the {@link java.util.ServiceLoader} class, to attempt ! * to locate and load an implementation of the service. If there are providers other than the implementation specific ! * default located, then the first provider that is not the default is instantiated and returned; Otherwise ! * the default implementation is returned if it is on the classpath or installed as a module. ! * ! * If a misconfigured provider is encountered and {@link java.util.ServiceConfigurationError} is thrown, the error will be wrapped ! * in a {@link javax.xml.parsers.FactoryConfigurationException}.</p> * </li> * <li> * Platform default <code>DocumentBuilderFactory</code> instance. * </li> * </ul>
*** 115,135 **** * * @throws FactoryConfigurationError if the implementation is not * available or cannot be instantiated. */ public static DocumentBuilderFactory newInstance() { ! try { ! return (DocumentBuilderFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ "javax.xml.parsers.DocumentBuilderFactory", /* The fallback implementation class name */ "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); ! } catch (FactoryFinder.ConfigurationError e) { ! throw new FactoryConfigurationError(e.getException(), ! e.getMessage()); ! } ! } /** * <p>Obtain a new instance of a <code>DocumentBuilderFactory</code> from class name. * This function is useful when there are multiple providers in the classpath. --- 117,135 ---- * * @throws FactoryConfigurationError if the implementation is not * available or cannot be instantiated. */ public static DocumentBuilderFactory newInstance() { ! // try { ! return (DocumentBuilderFactory) FactoryFinder.find(DocumentBuilderFactory.class, /* The default property name according to the JAXP spec */ "javax.xml.parsers.DocumentBuilderFactory", /* The fallback implementation class name */ "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); ! // } catch (FactoryConfigurationError e) { ! // throw e; ! // } } /** * <p>Obtain a new instance of a <code>DocumentBuilderFactory</code> from class name. * This function is useful when there are multiple providers in the classpath.
*** 166,178 **** */ public static DocumentBuilderFactory newInstance(String factoryClassName, ClassLoader classLoader){ try { //do not fallback if given classloader can't find the class, throw exception return (DocumentBuilderFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); ! } catch (FactoryFinder.ConfigurationError e) { ! throw new FactoryConfigurationError(e.getException(), ! e.getMessage()); } } /** * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder} --- 166,177 ---- */ public static DocumentBuilderFactory newInstance(String factoryClassName, ClassLoader classLoader){ try { //do not fallback if given classloader can't find the class, throw exception return (DocumentBuilderFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); ! } catch (FactoryConfigurationError e) { ! throw e; } } /** * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder}