src/javax/xml/parsers/SAXParserFactory.java
Print this page
*** 24,34 ****
*/
package javax.xml.parsers;
import javax.xml.validation.Schema;
-
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
/**
--- 24,33 ----
*** 36,46 ****
* obtain a SAX based parser to parse 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 SAXParserFactory {
/** The default property name according to the JAXP spec */
private static final String DEFAULT_PROPERTY_NAME = "javax.xml.parsers.SAXParserFactory";
--- 35,45 ----
* obtain a SAX based parser to parse 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 SAXParserFactory {
/** The default property name according to the JAXP spec */
private static final String DEFAULT_PROPERTY_NAME = "javax.xml.parsers.SAXParserFactory";
*** 85,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>
! * 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.SAXParserFactory</code>
! * in jars available to the runtime.
* </li>
* <li>
* Platform default <code>SAXParserFactory</code> instance.
* </li>
* </ul>
--- 84,100 ----
* 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>SAXParserFactory</code> instance.
* </li>
* </ul>
*** 119,138 ****
*
* @throws FactoryConfigurationError if the implementation is
* not available or cannot be instantiated.
*/
! public static SAXParserFactory newInstance() {
! try {
! return (SAXParserFactory) FactoryFinder.find(
/* The default property name according to the JAXP spec */
"javax.xml.parsers.SAXParserFactory",
/* The fallback implementation class name */
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
! } catch (FactoryFinder.ConfigurationError e) {
! throw new FactoryConfigurationError(e.getException(),
! e.getMessage());
}
}
/**
* <p>Obtain a new instance of a <code>SAXParserFactory</code> from class name.
--- 120,139 ----
*
* @throws FactoryConfigurationError if the implementation is
* not available or cannot be instantiated.
*/
! public static SAXParserFactory newInstance()
! {
! try{
! return (SAXParserFactory) FactoryFinder.find(SAXParserFactory.class,
/* The default property name according to the JAXP spec */
"javax.xml.parsers.SAXParserFactory",
/* The fallback implementation class name */
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
! } catch (FactoryConfigurationError e) {
! throw e;
}
}
/**
* <p>Obtain a new instance of a <code>SAXParserFactory</code> from class name.
*** 170,182 ****
*/
public static SAXParserFactory newInstance(String factoryClassName, ClassLoader classLoader){
try {
//do not fallback if given classloader can't find the class, throw exception
return (SAXParserFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false);
! } catch (FactoryFinder.ConfigurationError e) {
! throw new FactoryConfigurationError(e.getException(),
! e.getMessage());
}
}
/**
* <p>Creates a new instance of a SAXParser using the currently
--- 171,182 ----
*/
public static SAXParserFactory newInstance(String factoryClassName, ClassLoader classLoader){
try {
//do not fallback if given classloader can't find the class, throw exception
return (SAXParserFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false);
! } catch (FactoryConfigurationError e) {
! throw e;
}
}
/**
* <p>Creates a new instance of a SAXParser using the currently