FileDocCategorySizeDatePackage
SAXParser.javaAPI DocAndroid 1.5 API12576Wed May 06 22:41:06 BST 2009javax.xml.parsers

SAXParser

public abstract class SAXParser extends Object
Provides a wrapper around a SAX {@link XMLReader}. This abstract class only defines the interface, whereas the {@link SAXParserFactory} class is used to obtain instances of concrete subclasses.
since
Android 1.0

Fields Summary
Constructors Summary
protected SAXParser()
Do-nothing constructor. Prevents instantiation. To be overridden by concrete subclasses.

since
Android 1.0

        // Does nothing.
    
Methods Summary
public abstract org.xml.sax.ParsergetParser()
Queries the underlying SAX {@link Parser} object.

return
the SAX {@code Parser}.
throws
SAXException if a problem occurs.
since
Android 1.0

public abstract java.lang.ObjectgetProperty(java.lang.String name)
Queries a property of the underlying SAX {@link XMLReader}.

param
name the name of the property.
return
the value of the property.
throws
SAXNotRecognizedException if the property is not known to the underlying SAX {@code XMLReader}.
throws
SAXNotSupportedException if the property is known, but not supported by the underlying SAX {@code XMLReader}.
since
Android 1.0

public abstract org.xml.sax.XMLReadergetXMLReader()
Queries the underlying SAX XMLReader object.

return
the SAX XMLREader.
throws
SAXException if a problem occurs.
since
Android 1.0

public abstract booleanisNamespaceAware()
Reflects whether this {@code SAXParser} is namespace-aware.

return
{@code true} if the {@code SAXParser} is namespace-aware, or {@code false} otherwise.
since
Android 1.0

public abstract booleanisValidating()
Reflects whether this {@code SAXParser} is validating.

return
{@code true} if the {@code SAXParser} is validating, or {@code false} otherwise.
since
Android 1.0

public booleanisXIncludeAware()
Reflects whether this {@code SAXParser} is XInclude-aware.

return
{@code true} if the {@code SAXParser} is XInclude-aware, or {@code false} otherwise.
throws
UnsupportedOperationException if the underlying implementation doesn't know about XInclude at all (backwards compatibility).
since
Android 1.0

        throw new UnsupportedOperationException();
    
public voidparse(java.io.InputStream stream, org.xml.sax.HandlerBase handler)
Parses the given XML InputStream using the given SAX event handler.

param
stream the InputStream containing the XML document.
param
handler the SAX handler.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        if (stream == null) {
            throw new IllegalArgumentException("stream must not be null");
        }
        parse(new InputSource(stream), handler);
    
public voidparse(java.io.InputStream stream, org.xml.sax.HandlerBase handler, java.lang.String systemId)
Parses the given XML InputStream using the given SAX event handler and system ID.

param
stream the InputStream containing the XML document.
param
handler the SAX handler.
param
systemId the system ID.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        if (stream == null) {
            throw new IllegalArgumentException("stream must not be null");
        }
        InputSource source = new InputSource(stream);
        if (systemId != null) {
            source.setSystemId(systemId);
        }
        parse(source, handler);
    
public voidparse(java.io.InputStream stream, org.xml.sax.helpers.DefaultHandler handler)
Parses the given XML InputStream using the given SAX event handler.

param
stream the InputStream containing the XML document.
param
handler the SAX handler.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        parse(new InputSource(stream), handler);
    
public voidparse(java.io.InputStream stream, org.xml.sax.helpers.DefaultHandler handler, java.lang.String systemId)
Parses the given XML InputStream using the given SAX event handler and system ID.

param
stream the InputStream containing the XML document.
param
handler the SAX handler.
param
systemId the system ID.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        if (stream  == null) {
            throw new IllegalArgumentException("stream must not be null");
        }
        InputSource source = new InputSource(stream);
        if (systemId != null) {
            source.setSystemId(systemId);
        }
        parse(source, handler);
    
public voidparse(java.lang.String uri, org.xml.sax.HandlerBase handler)
Parses the contents of the given URI using the given SAX event handler.

param
uri the URI pointing to the XML document.
param
handler the SAX handler.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        if (uri == null) {
            throw new IllegalArgumentException("uri must not be null");
        }
        parse(new InputSource(uri), handler);
    
public voidparse(java.lang.String uri, org.xml.sax.helpers.DefaultHandler handler)
Parses the contents of the given URI using the given SAX event handler.

param
uri the URI pointing to the XML document.
param
handler the SAX handler.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        if (uri == null) {
            throw new IllegalArgumentException("uri must not be null");
        }
        parse(new InputSource(uri), handler);
    
public voidparse(org.xml.sax.InputSource source, org.xml.sax.HandlerBase handler)
Parses the given SAX {@link InputSource} using the given SAX event handler.

param
source the SAX {@code InputSource} containing the XML document.
param
handler the SAX handler.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        Parser parser = getParser();
        if (source == null) {
            throw new IllegalArgumentException("source must not be null");
        }

        if (handler != null) {
            parser.setDocumentHandler(handler);
            parser.setDTDHandler(handler);
            parser.setEntityResolver(handler);
            parser.setErrorHandler(handler);
        }

        parser.parse(source);
    
public voidparse(org.xml.sax.InputSource source, org.xml.sax.helpers.DefaultHandler handler)
Parses the given SAX {@link InputSource} using the given SAX event handler.

param
source the SAX {@code InputSource} containing the XML document.
param
handler the SAX handler.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        if (source == null) {
            throw new IllegalArgumentException("source must not be null");
        }
        XMLReader reader = getXMLReader();

        if (handler != null) {
            reader.setContentHandler(handler);
            reader.setDTDHandler(handler);
            reader.setEntityResolver(handler);
            reader.setErrorHandler(handler);
        }

        reader.parse(source);
    
public voidparse(java.io.File file, org.xml.sax.HandlerBase handler)
Parses the given XML file using the given SAX event handler.

param
file the file containing the XML document.
param
handler the SAX handler.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        if (file == null) {
            throw new IllegalArgumentException("file must not be null");
        }
        if (file.isDirectory()) {
            throw new IllegalArgumentException("file must not be a directory");
        }
        InputSource source = new InputSource("file:" + file.getAbsolutePath());
        parse(source, handler);
    
public voidparse(java.io.File file, org.xml.sax.helpers.DefaultHandler handler)
Parses the given XML file using the given SAX event handler.

param
file the file containing the XML document.
param
handler the SAX handler.
throws
SAXException if a problem occurs during SAX parsing.
throws
IOException if a general IO problem occurs.
since
Android 1.0

        if (file == null) {
            throw new IllegalArgumentException("file must not be null");
        }
        if (file.isDirectory()) {
            throw new IllegalArgumentException("file must not be a directory");
        }
        InputSource source = new InputSource("file:" + file.getAbsolutePath());
        parse(source, handler);
    
public voidreset()
Resets the {@code SAXParser} to the same state is was in after its creation.

since
Android 1.0

        // Do nothing.
    
public abstract voidsetProperty(java.lang.String name, java.lang.Object value)
Sets a property of the underlying SAX {@link XMLReader}.

param
name the name of the property.
param
value the value of the property.
throws
SAXNotRecognizedException if the property is not known to the underlying SAX {@code XMLReader}.
throws
SAXNotSupportedException if the property is known, but not supported by the underlying SAX {@code XMLReader}.
since
Android 1.0