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

All Implemented Interfaces:
    ContentHandler, Parser

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 XMLReader and makes it act as a SAX1 Parser . The XMLReader must support a true value for the http://xml.org/sax/features/namespace-prefixes property or parsing will fail with a 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.

Nested Class Summary:
final class  XMLReaderAdapter.AttributesAdapter  Internal class to wrap a SAX2 Attributes object for SAX1. 
Field Summary
 XMLReader xmlReader     
 DocumentHandler documentHandler     
 AttributesAdapter qAtts     
Constructor:
 public XMLReaderAdapter() throws SAXException 
    Create a new adapter.

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

    Throws:
    org.xml.sax.SAXException - If the embedded driver cannot be instantiated or if the org.xml.sax.driver property is not specified.
    exception: org.xml.sax.SAXException - If the embedded driver cannot be instantiated or if the org.xml.sax.driver property is not specified.
 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.
    Throws:
    java.lang.NullPointerException - If the argument is null.
    exception: java.lang.NullPointerException - If the argument is null.
Method from org.xml.sax.helpers.XMLReaderAdapter Summary:
characters,   endDocument,   endElement,   endPrefixMapping,   ignorableWhitespace,   parse,   parse,   processingInstruction,   setDTDHandler,   setDocumentHandler,   setDocumentLocator,   setEntityResolver,   setErrorHandler,   setLocale,   skippedEntity,   startDocument,   startElement,   startPrefixMapping
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.xml.sax.helpers.XMLReaderAdapter Detail:
 public  void characters(char[] ch,
    int start,
    int length) throws SAXException 
    Adapt a SAX2 characters event.
 public  void endDocument() throws SAXException 
    End document event.
 public  void endElement(String uri,
    String localName,
    String qName) throws SAXException 
    Adapt a SAX2 end element event.
 public  void endPrefixMapping(String prefix) 
    Adapt a SAX2 end prefix mapping event.
 public  void ignorableWhitespace(char[] ch,
    int start,
    int length) throws SAXException 
    Adapt a SAX2 ignorable whitespace event.
 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.

 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.

 public  void processingInstruction(String target,
    String data) throws SAXException 
    Adapt a SAX2 processing instruction event.
 public  void setDTDHandler(DTDHandler handler) 
    Register the DTD event handler.
 public  void setDocumentHandler(DocumentHandler handler) 
    Register the SAX1 document event handler.

    Note that the SAX1 document handler has no Namespace support.

 public  void setDocumentLocator(Locator locator) 
    Set a document locator.
 public  void setEntityResolver(EntityResolver resolver) 
    Register the entity resolver.
 public  void setErrorHandler(ErrorHandler handler) 
    Register the error event handler.
 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.

 public  void skippedEntity(String name) throws SAXException 
    Adapt a SAX2 skipped entity event.
 public  void startDocument() throws SAXException 
    Start document event.
 public  void startElement(String uri,
    String localName,
    String qName,
    Attributes atts) throws SAXException 
    Adapt a SAX2 start element event.
 public  void startPrefixMapping(String prefix,
    String uri) 
    Adapt a SAX2 start prefix mapping event.