This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


org.xml.sax.helpers
class ParserAdapter

java.lang.Object extended by org.xml.sax.helpers.ParserAdapter
All Implemented Interfaces:
DocumentHandler, XMLReader

public class ParserAdapter
extends Object
implements XMLReader, DocumentHandler

Adapt a SAX1 Parser as a SAX2 XMLReader.

This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.

This class wraps a SAX1 {@link org.xml.sax.Parser Parser} and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader}, with feature, property, and Namespace support. Note that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity} events, since SAX1 does not make that information available.

This adapter does not test for duplicate Namespace-qualified attribute names.


Constructor Summary

          Construct a new parser adapter.

          Construct a new parser adapter.
 
Method Summary
 void
characters(char[] ch, int start, int length)

          Adapter implementation method; do not call.
 void

          Adapter implementation method; do not call.
 void

          Adapter implementation method; do not call.
 ContentHandler

          Return the current content handler.
 DTDHandler

          Return the current DTD handler.
 EntityResolver

          Return the current entity resolver.
 ErrorHandler

          Return the current error handler.
 boolean

          Check a parser feature flag.
 Object

          Get a parser property.
 void
ignorableWhitespace(char[] ch, int start, int length)

          Adapter implementation method; do not call.
 void

          Parse an XML document.
 void
parse(String systemId)

          Parse an XML document.
 void

          Adapter implementation method; do not call.
 void

          Set the content handler.
 void

          Adapter implementation method; do not call.
 void

          Set the DTD handler.
 void

          Set the entity resolver.
 void

          Set the error handler.
 void
setFeature(String name, boolean value)

          Set a feature flag for the parser.
 void
setProperty(String name, Object value)

          Set a parser property.
 void

          Adapter implementation method; do not call.
 void

          Adapter implementation method; do not call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParserAdapter

public ParserAdapter()
              throws SAXException
Construct a new parser adapter.

Use the "org.xml.sax.parser" property to locate the embedded SAX1 driver.

Throws:
SAXException - If the embedded driver cannot be instantiated or if the org.xml.sax.parser property is not specified.

ParserAdapter

public ParserAdapter(Parser parser)
Construct a new parser adapter.

Note that the embedded parser cannot be changed once the adapter is created; to embed a different parser, allocate a new ParserAdapter.

Parameters:
parser - The SAX1 parser to embed.
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 characters event.

Parameters:
ch - An array of characters.
start - The starting position in the array.
length - The number of characters to use.
Throws:
SAXException - The client may raise a processing exception.

endDocument

public void endDocument()
                 throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 end document event.

Throws:
SAXException - The client may raise a processing exception.

endElement

public void endElement(String qName)
                throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 end element event.

Parameters:
qName - The qualified (prefixed) name.
Throws:
SAXException - The client may raise a processing exception.

getContentHandler

public ContentHandler getContentHandler()
Return the current content handler.

Returns:
The current content handler, or null if none was supplied.

getDTDHandler

public DTDHandler getDTDHandler()
Return the current DTD handler.

Returns:
the current DTD handler, or null if none was supplied

getEntityResolver

public EntityResolver getEntityResolver()
Return the current entity resolver.

Returns:
The current entity resolver, or null if none was supplied.

getErrorHandler

public ErrorHandler getErrorHandler()
Return the current error handler.

Returns:
The current error handler, or null if none was supplied.

getFeature

public boolean getFeature(String name)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException
Check a parser feature flag.

The only features recognized are namespaces and namespace-prefixes.

Parameters:
name - The feature name, as a complete URI.
Returns:
The current feature value.
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - If the feature is not currently readable.

getProperty

public Object getProperty(String name)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException
Get a parser property.

No properties are currently recognized.

Parameters:
name - The property name.
Returns:
The property value.
Throws:
SAXNotRecognizedException - If the property value can't be assigned or retrieved.
SAXNotSupportedException - If the property value is not currently readable.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 ignorable whitespace event.

Parameters:
ch - An array of characters.
start - The starting position in the array.
length - The number of characters to use.
Throws:
SAXException - The client may raise a processing exception.

parse

public void parse(InputSource input)
           throws IOException,
                  SAXException
Parse an XML document.

Parameters:
input - An input source for the document.
Throws:
IOException - If there is a problem reading the raw content of the document.
SAXException - If there is a problem processing the document.

parse

public void parse(String systemId)
           throws IOException,
                  SAXException
Parse an XML document.

Parameters:
systemId - The absolute URL of the document.
Throws:
IOException - If there is a problem reading the raw content of the document.
SAXException - If there is a problem processing the document.

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 processing instruction event.

Parameters:
target - The processing instruction target.
data - The remainder of the processing instruction
Throws:
SAXException - The client may raise a processing exception.

setContentHandler

public void setContentHandler(ContentHandler handler)
Set the content handler.

Parameters:
handler - the new content handler

setDocumentLocator

public void setDocumentLocator(Locator locator)
Adapter implementation method; do not call. Adapt a SAX1 document locator event.

Parameters:
locator - A document locator.

setDTDHandler

public void setDTDHandler(DTDHandler handler)
Set the DTD handler.

Parameters:
handler - the new DTD handler

setEntityResolver

public void setEntityResolver(EntityResolver resolver)
Set the entity resolver.

Parameters:
resolver - The new entity resolver.

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
Set the error handler.

Parameters:
handler - The new error handler.

setFeature

public void setFeature(String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set a feature flag for the parser.

The only features recognized are namespaces and namespace-prefixes.

Parameters:
name - The feature name, as a complete URI.
value - The requested feature value.
Throws:
SAXNotRecognizedException - If the feature can't be assigned or retrieved.
SAXNotSupportedException - If the feature can't be assigned that value.

setProperty

public void setProperty(String name,
                        Object value)
                 throws SAXNotRecognizedException,
                        SAXNotSupportedException
Set a parser property.

No properties are currently recognized.

Parameters:
name - The property name.
value - The property value.
Throws:
SAXNotRecognizedException - If the property value can't be assigned or retrieved.
SAXNotSupportedException - If the property can't be assigned that value.

startDocument

public void startDocument()
                   throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 start document event.

Throws:
SAXException - The client may raise a processing exception.

startElement

public void startElement(String qName,
                         AttributeList qAtts)
                  throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 startElement event.

If necessary, perform Namespace processing.

Parameters:
qName - The qualified (prefixed) name.
qAtts - The XML attribute list (with qnames).
Throws:
SAXException - The client may raise a processing exception.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.