Class XMLReaderFactory
This class contains static methods for creating an XML reader from an explicit class name, or based on runtime defaults:
try {
XMLReader myReader = XMLReaderFactory.createXMLReader();
} catch (SAXException e) {
System.err.println(e.getMessage());
}
Note to Distributions bundled with parsers:
You should modify the implementation of the no-arguments
createXMLReader to handle cases where the external
configuration mechanisms aren't set up. That method should do its
best to return a parser when one is in the class path, even when
nothing bound its class name to org.xml.sax.driver so
those configuration mechanisms would see it.
- Since:
- 1.4, SAX 2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic XMLReaderDeprecated.Obtains a new instance of aXMLReader.static XMLReadercreateXMLReader(String className) Deprecated.Attempt to create an XML reader from a class name.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Method Details
-
createXMLReader
Deprecated.Obtains a new instance of aXMLReader. This method uses the following ordered lookup procedure to find and load theXMLReaderimplementation class:- If the system property
org.xml.sax.driverhas a value, that is used as an XMLReader class name. -
Use the service-provider loading facility, defined by the
ServiceLoaderclass, to attempt to locate and load an implementation of the serviceXMLReaderby using the current thread's context class loader. If the context class loader is null, the system class loader will be used. -
Deprecated. Look for a class name in the
META-INF/services/org.xml.sax.driverfile in a jar file available to the runtime. -
Otherwise, the system-default implementation is returned.
- API Note:
- The process that looks for a class name in the
META-INF/services/org.xml.sax.driverfile in a jar file does not conform to the specification of the service-provider loading facility as defined inServiceLoaderand therefore does not support modularization. It is deprecated as of Java SE 9 and subject to removal in a future release. - Returns:
- a new XMLReader.
- Throws:
SAXException- If no default XMLReader class can be identified and instantiated.- See Also:
- If the system property
-
createXMLReader
Deprecated.Attempt to create an XML reader from a class name.Given a class name, this method attempts to load and instantiate the class as an XML reader.
Note that this method will not be usable in environments where the caller (perhaps an applet) is not permitted to load classes dynamically.
- Parameters:
className- a class name- Returns:
- A new XML reader.
- Throws:
SAXException- If the class cannot be loaded, instantiated, and cast to XMLReader.- See Also:
-
SAXParserFactoryinstead.