javax.xml.parsers
Class SAXParser

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

public abstract class SAXParser
extends java.lang.Object

Defines the API that wraps an org.xml.sax.Parser implementation class. Using this class an application to parse content using the SAX API.

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.

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

Since:
JAXP 1.0

Constructor Summary
protected SAXParser()
           
 
Method Summary
abstract  Parser getParser()
          Returns the SAX parser that is encapsultated by the implementation of this class.
abstract  boolean isNamespaceAware()
          Indicates whether or not this parser is configured to understand namespaces.
abstract  boolean isValidating()
          Indicates whether or not this parser is configured to validate XML documents.
 void parse(java.io.File f, HandlerBase hb)
          Parse the content of the file specified as XML using the specified org.xml.sax.HandlerBase.
 void parse(InputSource is, HandlerBase hb)
          Parse the content given org.xml.sax.InputSource as XML using the specified org.xml.sax.HandlerBase.
 void parse(java.io.InputStream is, HandlerBase hb)
          Parse the content of the given java.io.InputStream instance as XML using the specified org.xml.sax.HandlerBase.
 void parse(java.lang.String uri, HandlerBase hb)
          Parse the content described by the giving Uniform Resource Identifier (URI) as XML using the specified org.xml.sax.HandlerBase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXParser

protected SAXParser()
Method Detail

parse

public void parse(java.io.InputStream is,
                  HandlerBase hb)
           throws SAXException,
                  java.io.IOException
Parse the content of the given java.io.InputStream instance as XML using the specified org.xml.sax.HandlerBase.
Parameters:
is - InputStream containing the content to be parsed.
hb - The SAX HandlerBase to use.
Throws:
java.io.IOException - If any IO errors occur.
java.lang.IllegalArgumentException - If the given InputStream is null.
See Also:
DocumentHandler

parse

public void parse(java.lang.String uri,
                  HandlerBase hb)
           throws SAXException,
                  java.io.IOException
Parse the content described by the giving Uniform Resource Identifier (URI) as XML using the specified org.xml.sax.HandlerBase.
Parameters:
uri - The location of the content to be parsed.
hb - The SAX HandlerBase to use.
Throws:
java.io.IOException - If any IO errors occur.
java.lang.IllegalArgumentException - If the InputStream
See Also:
DocumentHandler

parse

public void parse(java.io.File f,
                  HandlerBase hb)
           throws SAXException,
                  java.io.IOException
Parse the content of the file specified as XML using the specified org.xml.sax.HandlerBase.
Parameters:
f - The file containing the XML to parse
hb - The SAX HandlerBase to use.
Throws:
java.io.IOException - If any IO errors occur.
java.lang.IllegalArgumentException - If the InputStream is null
See Also:
DocumentHandler

parse

public void parse(InputSource is,
                  HandlerBase hb)
           throws SAXException,
                  java.io.IOException
Parse the content given org.xml.sax.InputSource as XML using the specified org.xml.sax.HandlerBase.
Parameters:
is - The InputSource containing the content to be parsed.
hb - The SAX HandlerBase to use.
Throws:
java.io.IOException - If any IO errors occur.
java.lang.IllegalArgumentException - If the InputStream is null
See Also:
DocumentHandler

getParser

public abstract Parser getParser()
                          throws SAXException
Returns the SAX parser that is encapsultated by the implementation of this class.

isNamespaceAware

public abstract boolean isNamespaceAware()
Indicates whether or not this parser is configured to understand namespaces.

isValidating

public abstract boolean isValidating()
Indicates whether or not this parser is configured to validate XML documents.


Submit Feedback to xml-feedback@java.sun.com
Copyright © 1998-2000 Sun Microsystems, Inc. All Rights Reserved.

Sun Microsystems, Inc.
901 San Antonio Road
Palo Alto, California, 94303, U.S.A.