Home » xml-commons-external-1.4.01-src » org.xml » sax » helpers » [javadoc | source]
org.xml.sax.helpers
public class: ParserAdapter [javadoc | source]
java.lang.Object
   org.xml.sax.helpers.ParserAdapter

All Implemented Interfaces:
    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 Parser and makes it act as a SAX2 XMLReader , with feature, property, and Namespace support. Note that it is not possible to report skippedEntity events, since SAX1 does not make that information available.

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

Nested Class Summary:
final class  ParserAdapter.AttributeListAdapter  Adapt a SAX1 AttributeList as a SAX2 Attributes object.

This class is in the Public Domain, and comes with NO WARRANTY of any kind.

This wrapper class is used only when Namespace support is disabled -- it provides pretty much a direct mapping from SAX1 to SAX2, except that names and types are interned whenever requested.

 
Field Summary
 Locator locator     
 EntityResolver entityResolver     
 DTDHandler dtdHandler     
 ContentHandler contentHandler     
 ErrorHandler errorHandler     
Constructor:
 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.
    exception: SAXException - If the embedded driver cannot be instantiated or if the org.xml.sax.parser property is not specified.
 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.
    Throws:
    java.lang.NullPointerException - If the parser parameter is null.
    exception: java.lang.NullPointerException - If the parser parameter is null.
Method from org.xml.sax.helpers.ParserAdapter Summary:
characters,   endDocument,   endElement,   getContentHandler,   getDTDHandler,   getEntityResolver,   getErrorHandler,   getFeature,   getProperty,   ignorableWhitespace,   parse,   parse,   processingInstruction,   reportError,   setContentHandler,   setDTDHandler,   setDocumentLocator,   setEntityResolver,   setErrorHandler,   setFeature,   setProperty,   startDocument,   startElement
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.xml.sax.helpers.ParserAdapter Detail:
 public  void characters(char[] ch,
    int start,
    int length) throws SAXException 
    Adapter implementation method; do not call. Adapt a SAX1 characters event.
 public  void endDocument() throws SAXException 
    Adapter implementation method; do not call. Adapt a SAX1 end document event.
 public  void endElement(String qName) throws SAXException 
    Adapter implementation method; do not call. Adapt a SAX1 end element event.
 public ContentHandler getContentHandler() 
    Return the current content handler.
 public DTDHandler getDTDHandler() 
    Return the current DTD handler.
 public EntityResolver getEntityResolver() 
    Return the current entity resolver.
 public ErrorHandler getErrorHandler() 
    Return the current error handler.
 public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException 
    Check a parser feature flag.

    The only features recognized are namespaces and namespace-prefixes.

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

    No properties are currently recognized.

 public  void ignorableWhitespace(char[] ch,
    int start,
    int length) throws SAXException 
    Adapter implementation method; do not call. Adapt a SAX1 ignorable whitespace event.
 public  void parse(String systemId) throws IOException, SAXException 
    Parse an XML document.
 public  void parse(InputSource input) throws IOException, SAXException 
    Parse an XML document.
 public  void processingInstruction(String target,
    String data) throws SAXException 
    Adapter implementation method; do not call. Adapt a SAX1 processing instruction event.
  void reportError(String message) throws SAXException 
    Report a non-fatal error.
 public  void setContentHandler(ContentHandler handler) 
    Set the content handler.
 public  void setDTDHandler(DTDHandler handler) 
    Set the DTD handler.
 public  void setDocumentLocator(Locator locator) 
    Adapter implementation method; do not call. Adapt a SAX1 document locator event.
 public  void setEntityResolver(EntityResolver resolver) 
    Set the entity resolver.
 public  void setErrorHandler(ErrorHandler handler) 
    Set the error handler.
 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.

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

    No properties are currently recognized.

 public  void startDocument() throws SAXException 
    Adapter implementation method; do not call. Adapt a SAX1 start document event.
 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.