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 ----
*** 40,51 ****
*
* @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";
/**
* <p>Should Parsers be validating?</p>
*/
private boolean validating = false;
--- 39,48 ----
*** 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>
--- 82,101 ----
* 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, if present, is returned.
! * <br>
! * In case of {@link java.util.ServiceConfigurationError service
! * configuration error} a {@link javax.xml.parsers.FactoryConfigurationError}
! * will be thrown.
* </li>
* <li>
* Platform default <code>SAXParserFactory</code> instance.
* </li>
* </ul>
*** 107,117 ****
* <h2>Tip for Trouble-shooting</h2>
* <p>Setting the <code>jaxp.debug</code> system property will cause
* this method to print a lot of debug messages
* to <code>System.err</code> about what it is doing and where it is looking at.</p>
*
! * <p> If you have problems loading {@link DocumentBuilder}s, try:</p>
* <pre>
* java -Djaxp.debug=1 YourProgram ....
* </pre>
*
*
--- 109,119 ----
* <h2>Tip for Trouble-shooting</h2>
* <p>Setting the <code>jaxp.debug</code> system property will cause
* this method to print a lot of debug messages
* to <code>System.err</code> about what it is doing and where it is looking at.</p>
*
! * <p> If you have problems loading {@link SAXParser}s, try:</p>
* <pre>
* java -Djaxp.debug=1 YourProgram ....
* </pre>
*
*
*** 120,139 ****
* @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.
* This function is useful when there are multiple providers in the classpath.
--- 122,136 ----
* @throws FactoryConfigurationError if the implementation is
* not available or cannot be instantiated.
*/
public static SAXParserFactory newInstance() {
! return FactoryFinder.find(
/* The default property name according to the JAXP spec */
! SAXParserFactory.class,
/* The fallback implementation class name */
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
}
/**
* <p>Obtain a new instance of a <code>SAXParserFactory</code> from class name.
* This function is useful when there are multiple providers in the classpath.
*** 167,183 ****
* @see #newInstance()
*
* @since 1.6
*/
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
* configured factory parameters.</p>
--- 164,175 ----
*** 318,338 ****
public abstract boolean getFeature(String name)
throws ParserConfigurationException, SAXNotRecognizedException,
SAXNotSupportedException;
-
- /* <p>Get current state of canonicalization.</p>
- *
- * @return current state canonicalization control
- */
- /*
- public boolean getCanonicalization() {
- return canonicalState;
- }
- */
-
/**
* Gets the {@link Schema} object specified through
* the {@link #setSchema(Schema schema)} method.
*
*
--- 310,319 ----
*** 355,375 ****
+ this.getClass().getPackage().getSpecificationVersion()
+ "\""
);
}
- /** <p>Set canonicalization control to <code>true</code> or
- * </code>false</code>.</p>
- *
- * @param state of canonicalization
- */
- /*
- public void setCanonicalization(boolean state) {
- canonicalState = state;
- }
- */
-
/**
* <p>Set the {@link Schema} to be used by parsers created
* from this factory.</p>
*
* <p>When a {@link Schema} is non-null, a parser will use a validator
--- 336,345 ----