Class SAXParser

java.lang.Object
javax.xml.parsers.SAXParser

public abstract class SAXParser extends Object
Defines the API that wraps an XMLReader implementation class. In JAXP 1.0, this class wrapped the Parser interface, however this interface was replaced by the XMLReader. For ease of transition, this class continues to support the same name and interface as well as supporting new methods. An instance of this class can be obtained from the SAXParserFactory.newSAXParser() method. Once an instance of this class is obtained, XML can be parsed from a variety of input sources. These input sources are InputStreams, Files, URLs, and SAX InputSources.

This static method creates a new factory instance based on a system property setting or uses the platform default if no property has been defined.

The system property that controls which Factory implementation to create is named "javax.xml.parsers.SAXParserFactory". This property names a class that is a concrete subclass of this abstract class. If no property is defined, a platform default will be used.

As the content is parsed by the underlying parser, methods of the given HandlerBase or the DefaultHandler are called.

Implementors of this class which wrap an underlying implementation can consider using the ParserAdapter class to initially adapt their SAX1 implementation to work under this revised class.

Since:
1.4
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Protected constructor to prevent instantiation.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract Parser
    Returns the SAX parser that is encapsulated by the implementation of this class.
    abstract Object
    Returns the particular property requested for in the underlying implementation of XMLReader.
    Get a reference to the Schema being used by the XML processor.
    abstract XMLReader
    Returns the XMLReader that is encapsulated by the implementation of this class.
    abstract boolean
    Indicates whether or not this parser is configured to understand namespaces.
    abstract boolean
    Indicates whether or not this parser is configured to validate XML documents.
    boolean
    Get the XInclude processing mode for this parser.
    void
    Parse the content of the file specified as XML using the specified HandlerBase.
    void
    Parse the content of the file specified as XML using the specified DefaultHandler.
    void
    Parse the content of the given InputStream instance as XML using the specified HandlerBase.
    void
    parse(InputStream is, HandlerBase hb, String systemId)
    Parse the content of the given InputStream instance as XML using the specified HandlerBase.
    void
    Parse the content of the given InputStream instance as XML using the specified DefaultHandler.
    void
    parse(InputStream is, DefaultHandler dh, String systemId)
    Parse the content of the given InputStream instance as XML using the specified DefaultHandler.
    void
    Parse the content described by the giving Uniform Resource Identifier (URI) as XML using the specified HandlerBase.
    void
    Parse the content described by the giving Uniform Resource Identifier (URI) as XML using the specified DefaultHandler.
    void
    Parse the content given InputSource as XML using the specified HandlerBase.
    void
    Parse the content given InputSource as XML using the specified DefaultHandler.
    void
    Reset this SAXParser to its original configuration.
    abstract void
    setProperty(String name, Object value)
    Sets the particular property in the underlying implementation of XMLReader.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    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.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(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 by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(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 by notify or notifyAll) or the expiration of the timeout.