Name
XMLReaderFactory
Synopsis
This factory class defines two static factory
methods for creating XMLReader
objects. One method
takes the name of a class as its argument. It dynamically loads and
instantiates the class, then casts it to an
XMLReader
object. The second factory method takes
no arguments; it reads the system property named
"org.xml.sax.driver" and uses the
value of that property as the name of the class
XMLReader
implementation class to load and
instantiate. An application that instantiates its SAX parser using
the no-argument method of XMLReaderFactory
gains a
layer of independence from the underlying parser implementation. The
end user or system administrator of the system on which the
application is deployed can change the parser implementation simply
by setting a system property. Note that the
javax.xml.parsers
package provides a similar, but
somewhat more useful
SAXParserFactory
.
public final class XMLReaderFactory { // No Constructor // Public Class Methods public static org.xml.sax.XMLReader createXMLReader( ) throws org.xml.sax.SAXException; public static org.xml.sax.XMLReader createXMLReader(String className) throws org.xml.sax.SAXException; }
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.