javax.xml.parsers
Class SAXParser

java.lang.Object
  |
  +--javax.xml.parsers.SAXParser

public abstract class SAXParser
extends java.lang.Object

Builder for SAX parsers

Normally, users will create a SAX parser as follows:


 SAXParserFactory factory = SAXParserFactory.newInstance();
 Parser parser = factory.newSAXParser();
 parser.setDocumentHandler(myDocumentHandler);
 parser.parse(myInputSource);
 


Constructor Summary
SAXParser()
           
 
Method Summary
abstract  org.xml.sax.Parser getParser()
          Returns the SAX parser
abstract  java.lang.Object getProperty(java.lang.String name)
          Returns a property from the underlying XMLReader
abstract  org.xml.sax.XMLReader getXMLReader()
          Returns the encapsulated reader.
abstract  boolean isNamespaceAware()
          Returns true if the parser is namespace-aware
abstract  boolean isValidating()
          Returns true if the parser is validating
 void parse(java.io.File file, org.xml.sax.helpers.DefaultHandler handler)
          Parse given a File
 void parse(java.io.File file, org.xml.sax.HandlerBase base)
          Parse a given file using base as the callback.
 void parse(org.xml.sax.InputSource source, org.xml.sax.helpers.DefaultHandler handler)
          Parse given an input source.
 void parse(org.xml.sax.InputSource source, org.xml.sax.HandlerBase base)
          Parse given an input source
 void parse(java.io.InputStream stream, org.xml.sax.helpers.DefaultHandler handler)
          Parse the given input stream using handler as the callback.
 void parse(java.io.InputStream stream, org.xml.sax.helpers.DefaultHandler handler, java.lang.String systemId)
          Parse the given input stream using handler as the callback and systemId to resolve relative paths.
 void parse(java.io.InputStream stream, org.xml.sax.HandlerBase base)
          Parse the given input stream using base as the callback.
 void parse(java.io.InputStream stream, org.xml.sax.HandlerBase base, java.lang.String systemId)
          Parse the given input stream using base as the callback and systemId to resolve relative paths.
 void parse(java.lang.String uri, org.xml.sax.helpers.DefaultHandler handler)
          Parse given a path name using handler as the callback.
 void parse(java.lang.String uri, org.xml.sax.HandlerBase base)
          Parse given a path name.
abstract  void setProperty(java.lang.String name, java.lang.Object value)
          Sets a property for the underlying XMLReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXParser

public SAXParser()
Method Detail

getParser

public abstract org.xml.sax.Parser getParser()
                                      throws org.xml.sax.SAXException
Returns the SAX parser

getProperty

public abstract java.lang.Object getProperty(java.lang.String name)
                                      throws org.xml.sax.SAXNotRecognizedException
Returns a property from the underlying XMLReader
Parameters:
name - the name of the property

setProperty

public abstract void setProperty(java.lang.String name,
                                 java.lang.Object value)
                          throws org.xml.sax.SAXNotRecognizedException
Sets a property for the underlying XMLReader
Parameters:
name - the name of the property
object - the new value

getXMLReader

public abstract org.xml.sax.XMLReader getXMLReader()
                                            throws org.xml.sax.SAXException
Returns the encapsulated reader.

isNamespaceAware

public abstract boolean isNamespaceAware()
Returns true if the parser is namespace-aware

isValidating

public abstract boolean isValidating()
Returns true if the parser is validating

parse

public void parse(java.io.File file,
                  org.xml.sax.helpers.DefaultHandler handler)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse given a File
Parameters:
file - a path to the file to open
handler - the SAX handler base to receive events

parse

public void parse(java.io.File file,
                  org.xml.sax.HandlerBase base)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse a given file using base as the callback.

Applications should use the DefaultHandler version instead.

Parameters:
file - a path to the file to open
base - the SAX handler to receive events

parse

public void parse(java.io.InputStream stream,
                  org.xml.sax.helpers.DefaultHandler handler)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse the given input stream using handler as the callback.
Parameters:
stream - the input stream to be used as a source
handler - the SAX handler to receive events

parse

public void parse(java.io.InputStream stream,
                  org.xml.sax.HandlerBase base)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse the given input stream using base as the callback.

Applications should use the DefaultHandler version instead.

Parameters:
stream - the input stream to be used as a source
base - the SAX handler base to receive events

parse

public void parse(java.io.InputStream stream,
                  org.xml.sax.helpers.DefaultHandler handler,
                  java.lang.String systemId)
           throws org.xml.sax.SAXException,
                  java.lang.IllegalArgumentException,
                  java.io.IOException
Parse the given input stream using handler as the callback and systemId to resolve relative paths.
Parameters:
stream - the input stream to be used as a source
handler - the SAX handler to receive events
systemId - url for resolving relative paths.

parse

public void parse(java.io.InputStream stream,
                  org.xml.sax.HandlerBase base,
                  java.lang.String systemId)
           throws org.xml.sax.SAXException,
                  java.lang.IllegalArgumentException,
                  java.io.IOException
Parse the given input stream using base as the callback and systemId to resolve relative paths.

Applications should use the DefaultHandler version instead.

Parameters:
stream - the input stream to be used as a source
base - the SAX handler base to receive events
systemId - url for resolving relative paths.

parse

public void parse(java.lang.String uri,
                  org.xml.sax.helpers.DefaultHandler handler)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse given a path name using handler as the callback.
Parameters:
uri - a path to the file to open
handler - the SAX handler to receive events

parse

public void parse(java.lang.String uri,
                  org.xml.sax.HandlerBase base)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse given a path name.

Applications should use the DefaultHandler version instead.

Parameters:
uri - a path to the file to open
base - the SAX handler to receive events

parse

public void parse(org.xml.sax.InputSource source,
                  org.xml.sax.helpers.DefaultHandler handler)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse given an input source.
Parameters:
source - a SAX input source
handler - the SAX handler to receive events

parse

public void parse(org.xml.sax.InputSource source,
                  org.xml.sax.HandlerBase base)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse given an input source
Parameters:
source - a SAX input source
base - the SAX handler base to receive events