Name
SAXParserFactory
Synopsis
This
class
is a factory for SAXParser objects. Obtain a
SAXParserFactory by calling the
newInstance( ) method which instantiates the
default SAXParserFactory subclass provided with
your Java implementation, or instantiates some other
SAXParserFactory that has been
“plugged in”.
Once you have a SAXParserFactory object, you can
use setValidating( ) and
setNamespaceAware( ) to specify whether the
parsers it creates will be validating parsers or not and whether they
will know how to handle XML namespaces. You may also call
setFeature( )
to set a feature of the underlying parser implementation. See
http://www.saxproject.org for the
names of standard parser features that can be enabled and disabled
with this method. In Java 5.0, call setXIncludeAware(
)
to specify that created parsers will
recognize XInclude markup. Use setSchema(
)
to specify a W3C XML Schema against
which parsers should validate the document.
Once you have created and configured your factory object, simply call
newSAXParser( )
to create a SAXParser
object. Note that SAXParserFactory implementations
are not typically threadsafe.
The javax.xml.parsers package allows parser
implementations to be “plugged in”.
This pluggability is provided by the getInstance(
) method, which follows the following steps to determine
which SAXBuilderFactory subclass to use:
If the
javax.xml.parsers.SAXParserFactorysystem property is defined, then the class specified by that property is used.Otherwise, if the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access