| Prev Class | Next Class | Frames | No Frames | 
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr | 
java.lang.Objectorg.xml.sax.helpers.XMLReaderAdapterThis 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.
Parser, XMLReaderConstructor Summary | |
  | |
  | |
Method Summary | |
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
 void | 
  | 
public XMLReaderAdapter()
            throws SAXExceptionCreate 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.
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.
public void characters(ch[] ,
                       int start,
                       int length)
            throws SAXExceptionAdapt a SAX2 characters event.
- Specified by:
 - characters in interface ContentHandler
 
- Parameters:
 start- The starting position in the array.length- The number of characters to use.
- Throws:
 SAXException- The client may raise a processing exception.
public void endDocument()
            throws SAXExceptionEnd document event.
- Specified by:
 - endDocument in interface ContentHandler
 
- Throws:
 SAXException- The client may raise a processing exception.
- See Also:
 ContentHandler.endDocument()
public void endElement(String uri,
                       String localName,
                       String qName)
            throws SAXExceptionAdapt a SAX2 end element event.
- Specified by:
 - endElement in interface ContentHandler
 
- Parameters:
 uri- The Namespace URI.localName- The Namespace local name.qName- The qualified (prefixed) name.
- Throws:
 SAXException- The client may raise a processing exception.
public void endPrefixMapping(String prefix)
Adapt a SAX2 end prefix mapping event.
- Specified by:
 - endPrefixMapping in interface ContentHandler
 
- Parameters:
 prefix- The prefix being mapped.
public void ignorableWhitespace(ch[] ,
                                int start,
                                int length)
            throws SAXExceptionAdapt a SAX2 ignorable whitespace event.
- Specified by:
 - ignorableWhitespace in interface ContentHandler
 
- Parameters:
 start- The starting position in the array.length- The number of characters to use.
- Throws:
 SAXException- The client may raise a processing exception.
public void parse(String systemId)
            throws IOException,
                   SAXExceptionParse 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:
 SAXException- If there is a problem processing the document.
- See Also:
 parse(InputSource),org.xml.sax.Parser.parse(java.lang.String)
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:
 SAXException- If there is a problem processing the document.
- See Also:
 parse(java.lang.String),Parser.parse(InputSource)
public void processingInstruction(String target,
                                  String data)
            throws SAXExceptionAdapt a SAX2 processing instruction event.
- Specified by:
 - processingInstruction in interface ContentHandler
 
- Parameters:
 target- The processing instruction target.data- The remainder of the processing instruction
- Throws:
 SAXException- The client may raise a processing exception.
public void setDTDHandler(DTDHandler handler)
Register the DTD event handler.
- Specified by:
 - setDTDHandler in interface Parser
 
- Parameters:
 handler- The new DTD event handler.
- See Also:
 Parser.setDTDHandler(DTDHandler)
public void setDocumentHandler(DocumentHandler handler)
Register the SAX1 document event handler. Note that the SAX1 document handler has no Namespace support.
- Specified by:
 - setDocumentHandler in interface Parser
 
- Parameters:
 handler- The new SAX1 document event handler.
public void setDocumentLocator(Locator locator)
Set a document locator.
- Specified by:
 - setDocumentLocator in interface ContentHandler
 
- Parameters:
 locator- The document locator.
public void setEntityResolver(EntityResolver resolver)
Register the entity resolver.
- Specified by:
 - setEntityResolver in interface Parser
 
- Parameters:
 resolver- The new resolver.
public void setErrorHandler(ErrorHandler handler)
Register the error event handler.
- Specified by:
 - setErrorHandler in interface Parser
 
- Parameters:
 handler- The new error event handler.
- See Also:
 Parser.setErrorHandler(ErrorHandler)
public void setLocale(Locale locale)
            throws SAXExceptionSet 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.
- See Also:
 Parser.setLocale(Locale)
public void skippedEntity(String name)
            throws SAXExceptionAdapt a SAX2 skipped entity event.
- Specified by:
 - skippedEntity in interface ContentHandler
 
- Parameters:
 name- The name of the skipped entity.
- Throws:
 SAXException- Throwable by subclasses.
- See Also:
 ContentHandler.skippedEntity(String)
public void startDocument()
            throws SAXExceptionStart document event.
- Specified by:
 - startDocument in interface ContentHandler
 
- Throws:
 SAXException- The client may raise a processing exception.
- See Also:
 ContentHandler.startDocument()
public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
            throws SAXExceptionAdapt a SAX2 start element event.
- Specified by:
 - startElement in interface ContentHandler
 
- 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.
- See Also:
 ContentHandler.endDocument()
public void startPrefixMapping(String prefix,
                               String uri)Adapt a SAX2 start prefix mapping event.
- Specified by:
 - startPrefixMapping in interface ContentHandler
 
- Parameters:
 prefix- The prefix being mapped.uri- The Namespace URI being mapped to.