⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
javax.xml.parsers

Class SAXParser

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


public abstract class SAXParser
extends java.lang.Object

Wraps a SAX2 (or SAX1) parser.

Note that parsing with methods on this interface requires use of one of the optional SAX base classes. It's usually preferable to use the SAX parser APIs directly. SAX gives much more flexibility about how application classes are organized, and about how the document entity is packaged for delivery to the parser. And JAXP doesn't otherwise provide access to the SAX2 extension handlers for lexical or declaration events.

Authors:
Andrew Selkirk
David Brownell

Constructor Summary

SAXParser()

Only subclasses may use the constructor.

Method Summary

Parser

getParser()

Get a (deprecated) SAX1 driver for the underlying parser.

java.lang.Object

getProperty(java.lang.String id)

XMLReader

getXMLReader()

Get a SAX2 driver for the underlying parser.

boolean

isNamespaceAware()

boolean

isValidating()

void

parse(java.io.InputStream stream, HandlerBase handler)

Parse using (deprecated) SAX1 style handlers, and a byte stream (with no URI).

void

parse(java.io.InputStream stream, HandlerBase handler, java.lang.String systemID)

Parse using (deprecated) SAX1 style handlers, and a byte stream with a specified URI.

void

parse(java.io.InputStream stream, DefaultHandler def)

Parse using SAX2 style handlers, and a byte stream (with no URI).

void

parse(java.io.InputStream stream, DefaultHandler def, java.lang.String systemID)

Parse using SAX2 style handlers, and a byte stream with a specified URI.

void

parse(java.lang.String uri, HandlerBase handler)

Parse using (deprecated) SAX1 style handlers, and a URI for the document entity.

void

parse(java.lang.String uri, DefaultHandler def)

Parse using SAX2 style handlers, and a URI for the document entity.

void

parse(java.io.File file, HandlerBase handler)

Parse using (deprecated) SAX1 style handlers, turning a file name into the document URI.

void

parse(java.io.File file, DefaultHandler def)

Parse using SAX2 style handlers, turning a file name into the document URI.

void

parse(InputSource source, HandlerBase handler)

Parse using (deprecated) SAX1 style handlers.

void

parse(InputSource source, DefaultHandler def)

Parse using SAX2 style handlers.

void

setProperty(java.lang.String id, java.lang.Object value)

Constructor Details

SAXParser

protected SAXParser()

Only subclasses may use the constructor.

Method Details

getParser

public Parser getParser()

Get a (deprecated) SAX1 driver for the underlying parser.


getProperty

public Object getProperty(java.lang.String id)

Parameters:
id

getXMLReader

public XMLReader getXMLReader()

Get a SAX2 driver for the underlying parser.

Since:
1.1

isNamespaceAware

public boolean isNamespaceAware()


isValidating

public boolean isValidating()


parse

public void parse(java.io.File file, HandlerBase handler)

Parse using (deprecated) SAX1 style handlers, turning a file name into the document URI.

Parameters:
file
handler
Throws:
java.lang.IllegalArgumentException - if file is null

parse

public void parse(java.io.File file, DefaultHandler def)

Parse using SAX2 style handlers, turning a file name into the document URI.

Parameters:
file
def
Throws:
java.lang.IllegalArgumentException - if file is null

parse

public void parse(java.io.InputStream stream, HandlerBase handler, java.lang.String systemID)

Parse using (deprecated) SAX1 style handlers, and a byte stream with a specified URI.

Parameters:
stream
handler
systemID
Throws:
java.lang.IllegalArgumentException - if InputStream is null

parse

public void parse(java.io.InputStream stream, HandlerBase handler)

Parse using (deprecated) SAX1 style handlers, and a byte stream (with no URI). Avoid using this API, since relative URIs in the document need to be resolved against the document entity's URI, and good diagnostics also need that URI.

Parameters:
stream
handler
Throws:
java.lang.IllegalArgumentException - if InputStream is null

parse

public void parse(java.io.InputStream stream, DefaultHandler def, java.lang.String systemID)

Parse using SAX2 style handlers, and a byte stream with a specified URI.

Parameters:
stream
def
systemID
Throws:
java.lang.IllegalArgumentException - if InputStream is null

parse

public void parse(java.io.InputStream stream, DefaultHandler def)

Parse using SAX2 style handlers, and a byte stream (with no URI). Avoid using this API, since relative URIs in the document need to be resolved against the document entity's URI, and good diagnostics also need that URI.

Parameters:
stream
def
Throws:
java.lang.IllegalArgumentException - if InputStream is null

parse

public void parse(java.lang.String uri, HandlerBase handler)

Parse using (deprecated) SAX1 style handlers, and a URI for the document entity.

Parameters:
uri
handler
Throws:
java.lang.IllegalArgumentException - if URI is null

parse

public void parse(java.lang.String uri, DefaultHandler def)

Parse using SAX2 style handlers, and a URI for the document entity.

Parameters:
uri
def
Throws:
java.lang.IllegalArgumentException - if URI is null

parse

public void parse(InputSource source, HandlerBase handler)

Parse using (deprecated) SAX1 style handlers.

Parameters:
source
handler
Throws:
java.lang.IllegalArgumentException - if InputSource is null

parse

public void parse(InputSource source, DefaultHandler def)

Parse using SAX2 style handlers.

Parameters:
source
def
Throws:
java.lang.IllegalArgumentException - if InputSource is null

setProperty

public void setProperty(java.lang.String id, java.lang.Object value)

Parameters:
id
value