--- old/src/javax/xml/parsers/DocumentBuilderFactory.java 2012-12-06 18:30:11.000000000 +0100 +++ new/src/javax/xml/parsers/DocumentBuilderFactory.java 2012-12-06 18:30:11.000000000 +0100 @@ -40,9 +40,6 @@ public abstract class DocumentBuilderFactory { - /** The default property name according to the JAXP spec */ - private static final String DEFAULT_PROPERTY_NAME = "javax.xml.parsers.DocumentBuilderFactory"; - private boolean validating = false; private boolean namespaceAware = false; private boolean whitespace = false; @@ -50,8 +47,6 @@ private boolean ignoreComments = false; private boolean coalescing = false; - private boolean canonicalState = false; - /** *
Protected constructor to prevent instantiation. * Use {@link #newInstance()}.
@@ -66,6 +61,7 @@ * This method uses the following ordered lookup procedure to determine * theDocumentBuilderFactory
implementation class to
* load:
+ *
* javax.xml.parsers.DocumentBuilderFactory
system
@@ -85,16 +81,22 @@
* of any property in jaxp.properties after it has been read for the first time.
* META-INF/services/javax.xml.parsers.DocumentBuilderFactory
- * in jars available to the runtime.
+ * 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.
* DocumentBuilderFactory
instance.
+ * Otherwise the default implementation, if present, is returned.
* + * In case of {@link java.util.ServiceConfigurationError service + * configuration error}, or if no implementation is found, + * a {@link javax.xml.parsers.FactoryConfigurationError} + * will be thrown. + *
* * Once an application has obtained a reference to a *DocumentBuilderFactory
it can use the factory to
@@ -117,17 +119,11 @@
* available or cannot be instantiated.
*/
public static DocumentBuilderFactory newInstance() {
- try {
- return (DocumentBuilderFactory) FactoryFinder.find(
+ return FactoryFinder.find(
/* The default property name according to the JAXP spec */
- "javax.xml.parsers.DocumentBuilderFactory",
+ DocumentBuilderFactory.class, // "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());
- }
-
}
/**
@@ -165,13 +161,8 @@
* @since 1.6
*/
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());
- }
}
/**
@@ -391,75 +382,64 @@
public abstract Object getAttribute(String name)
throws IllegalArgumentException;
- /**
- * Set a feature for this DocumentBuilderFactory
and DocumentBuilder
s created by this factory.
- * Feature names are fully qualified {@link java.net.URI}s.
- * Implementations may define their own features.
- * A {@link ParserConfigurationException} is thrown if this DocumentBuilderFactory
or the
- * DocumentBuilder
s it creates cannot support the feature.
- * It is possible for a DocumentBuilderFactory
to expose a feature value but be unable to change its state.
- *
- * All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. - * When the feature is:
- *true
: the implementation will limit XML processing to conform to implementation limits.
- * Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources.
- * If XML processing is limited for security reasons, it will be reported via a call to the registered
- * {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}.
- * See {@link DocumentBuilder#setErrorHandler(org.xml.sax.ErrorHandler errorHandler)}.
- * false
: the implementation will processing XML according to the XML specifications without
- * regard to possible implementation limits.
- * true
or false
.
- *
- * @throws ParserConfigurationException if this DocumentBuilderFactory
or the DocumentBuilder
s
- * it creates cannot support this feature.
+ /**
+ * Set a feature for this DocumentBuilderFactory
and DocumentBuilder
s created by this factory.
+ * Feature names are fully qualified {@link java.net.URI}s.
+ * Implementations may define their own features.
+ * A {@link ParserConfigurationException} is thrown if this DocumentBuilderFactory
or the
+ * DocumentBuilder
s it creates cannot support the feature.
+ * It is possible for a DocumentBuilderFactory
to expose a feature value but be unable to change its state.
+ *
+ * All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is:
+ *true
: the implementation will limit XML processing to conform to implementation limits.
+ * Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources.
+ * If XML processing is limited for security reasons, it will be reported via a call to the registered
+ * {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}.
+ * See {@link DocumentBuilder#setErrorHandler(org.xml.sax.ErrorHandler errorHandler)}.
+ * false
: the implementation will processing XML according to the XML specifications without
+ * regard to possible implementation limits.
+ * true
or false
.
+ *
+ * @throws ParserConfigurationException if this DocumentBuilderFactory
or the DocumentBuilder
s
+ * it creates cannot support this feature.
* @throws NullPointerException If the name
parameter is null.
- */
- public abstract void setFeature(String name, boolean value)
- throws ParserConfigurationException;
-
- /**
- * Get the state of the named feature.
- * - *
- * Feature names are fully qualified {@link java.net.URI}s.
- * Implementations may define their own features.
- * An {@link ParserConfigurationException} is thrown if this DocumentBuilderFactory
or the
- * DocumentBuilder
s it creates cannot support the feature.
- * It is possible for an DocumentBuilderFactory
to expose a feature value but be unable to change its state.
- *
DocumentBuilderFactory
- * or the DocumentBuilder
s it creates cannot support this feature.
- */
- public abstract boolean getFeature(String name)
- throws ParserConfigurationException;
-
-
- /** Get current state of canonicalization.
- * - * @return current state canonicalization control - */ - /* - public boolean getCanonicalization() { - return canonicalState; - } - */ + */ + public abstract void setFeature(String name, boolean value) + throws ParserConfigurationException; + + /** + *Get the state of the named feature.
+ * + *
+ * Feature names are fully qualified {@link java.net.URI}s.
+ * Implementations may define their own features.
+ * An {@link ParserConfigurationException} is thrown if this DocumentBuilderFactory
or the
+ * DocumentBuilder
s it creates cannot support the feature.
+ * It is possible for an DocumentBuilderFactory
to expose a feature value but be unable to change its state.
+ *
DocumentBuilderFactory
+ * or the DocumentBuilder
s it creates cannot support this feature.
+ */
+ public abstract boolean getFeature(String name)
+ throws ParserConfigurationException;
/**
@@ -488,17 +468,6 @@
}
- /* Set canonicalization control to true
or
- * false.
Set the {@link Schema} to be used by parsers created * from this factory.