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 XMLReaderAdapter

java.lang.Object extended by org.xml.sax.helpers.XMLReaderAdapter
All Implemented Interfaces:
ContentHandler, Parser

public class XMLReaderAdapter
extends Object
implements Parser, ContentHandler

Adapt a SAX2 XMLReader as a SAX1 Parser.

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 SAX2 {@link org.xml.sax.XMLReader XMLReader} and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader must support a true value for the http://xml.org/sax/features/namespace-prefixes property or parsing will fail with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader supports a false value for the http://xml.org/sax/features/namespaces property, that will also be used to improve efficiency.


Constructor Summary

          Create a new adapter.

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

          Adapt a SAX2 characters event.
 void

          End document event.
 void
endElement(String uri, String localName, String qName)

          Adapt a SAX2 end element event.
 void

          Adapt a SAX2 end prefix mapping event.
 void
ignorableWhitespace(char[] ch, int start, int length)

          Adapt a SAX2 ignorable whitespace event.
 void

          Parse the document.
 void
parse(String systemId)

          Parse the document.
 void

          Adapt a SAX2 processing instruction event.
 void

          Register the SAX1 document event handler.
 void

          Set a document locator.
 void

          Register the DTD event handler.
 void

          Register the entity resolver.
 void

          Register the error event handler.
 void
setLocale(Locale locale)

          Set the locale for error reporting.
 void

          Adapt a SAX2 skipped entity event.
 void

          Start document event.
 void
startElement(String uri, String localName, String qName, Attributes atts)

          Adapt a SAX2 start element event.
 void

          Adapt a SAX2 start prefix mapping event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLReaderAdapter

public XMLReaderAdapter()
                 throws SAXException
Create a new adapter.

Use the "org.xml.sax.driver" property to locate the SAX2 driver to embed.

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

XMLReaderAdapter

public XMLReaderAdapter(XMLReader xmlReader)
Create a new adapter.

Create a new adapter, wrapped around a SAX2 XMLReader. The adapter will make the XMLReader act like a SAX1 Parser.

Parameters:
xmlReader - The SAX2 XMLReader to wrap.
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Adapt a SAX2 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
End document event.

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

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Adapt a SAX2 end element event.

Parameters:
uri - The Namespace URI.
localName - The Namespace local name.
qName - The qualified (prefixed) name.
Throws:
SAXException - The client may raise a processing exception.

endPrefixMapping

public void endPrefixMapping(String prefix)
Adapt a SAX2 end prefix mapping event.

Parameters:
prefix - The prefix being mapped.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Adapt a SAX2 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 the document.

This method will throw an exception if the embedded XMLReader does not support the http://xml.org/sax/features/namespace-prefixes property.

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 the document.

This method will throw an exception if the embedded XMLReader does not support the http://xml.org/sax/features/namespace-prefixes property.

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
Adapt a SAX2 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.

setDocumentHandler

public void setDocumentHandler(DocumentHandler handler)
Register the SAX1 document event handler.

Note that the SAX1 document handler has no Namespace support.

Parameters:
handler - The new SAX1 document event handler.

setDocumentLocator

public void setDocumentLocator(Locator locator)
Set a document locator.

Parameters:
locator - The document locator.

setDTDHandler

public void setDTDHandler(DTDHandler handler)
Register the DTD event handler.

Parameters:
handler - The new DTD event handler.

setEntityResolver

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

Parameters:
resolver - The new resolver.

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
Register the error event handler.

Parameters:
handler - The new error event handler.

setLocale

public void setLocale(Locale locale)
               throws SAXException
Set the locale for error reporting.

This is not supported in SAX2, and will always throw an exception.

Parameters:
locale - the locale for error reporting.
Throws:
SAXException - Thrown unless overridden.

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Adapt a SAX2 skipped entity event.

Parameters:
name - The name of the skipped entity.
Throws:
SAXException - Throwable by subclasses.

startDocument

public void startDocument()
                   throws SAXException
Start document event.

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

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Adapt a SAX2 start element event.

Parameters:
uri - The Namespace URI.
localName - The Namespace local name.
qName - The qualified (prefixed) name.
atts - The SAX2 attributes.
Throws:
SAXException - The client may raise a processing exception.

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
Adapt a SAX2 start prefix mapping event.

Parameters:
prefix - The prefix being mapped.
uri - The Namespace URI being mapped to.


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/.