SAXParserFactory
instead.@Deprecated(since="9") public final class XMLReaderFactory extends Object
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.
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.
Modifier and Type | Method | Description |
---|---|---|
static XMLReader |
createXMLReader() |
Deprecated.
Obtains a new instance of a
XMLReader . |
static XMLReader |
createXMLReader(String className) |
Deprecated.
Attempt to create an XML reader from a class name.
|
public static XMLReader createXMLReader() throws SAXException
XMLReader
.
This method uses the following ordered lookup procedure to find and load
the XMLReader
implementation class:
org.xml.sax.driver
has a value, that is used as an XMLReader class name. ServiceLoader
class, to attempt to locate and load an
implementation of the service XMLReader
by using the
current thread's context class loader.
If the context class loader is null, the
system class loader will
be used.
META-INF/services/org.xml.sax.driver
file in a jar file available to the runtime.Otherwise, the system-default implementation is returned.
META-INF/services/org.xml.sax.driver
file in a jar file does not
conform to the specification of the service-provider loading facility
as defined in ServiceLoader
and therefore does not
support modularization. It is deprecated as of Java SE 9 and subject to
removal in a future release.SAXException
- If no default XMLReader class
can be identified and instantiated.createXMLReader(java.lang.String)
public static XMLReader createXMLReader(String className) throws SAXException
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.
SAXException
- If the class cannot be
loaded, instantiated, and cast to XMLReader.createXMLReader()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-internal+0-adhoc.mlchung.jdk9-jdeps