The ParserAdapter Class
The ParserAdapter
class uses the adapter design pattern to convert a SAX1 org.xml.sax.Parser
object into a SAX2
org.xml.sax.XMLReader
object.
As more parsers support SAX2, this class becomes less necessary.
Note that some SAX2 features are not available through an adapted
SAX1 parser. For instance, a parser created with this adapter does
not report skipped entities and does not support most features and
properties, not even the core features and properties:
package org.xml.sax.helpers; public classParserAdapter
implements XMLReader, DocumentHandler { publicParserAdapter
( ) throws SAXException; publicParserAdapter
(Parserparser
); // Implementation of org.xml.sax.XMLReader. public voidsetFeature
(Stringname
, booleanstate
) throws SAXNotRecognizedException, SAXNotSupportedException; public booleangetFeature
(Stringname
) throws SAXNotRecognizedException, SAXNotSupportedException; public voidsetProperty
(Stringname
, Objectvalue
) throws SAXNotRecognizedException, SAXNotSupportedException; public ObjectgetProperty
(Stringname
) throws SAXNotRecognizedException, SAXNotSupportedException; public voidsetEntityResolver
(EntityResolverresolver
); public EntityResolvergetEntityResolver
( ); public voidsetDTDHandler
(DTDHandlerhandler
); public DTDHandlergetDTDHandler
( ); public voidsetContentHandler
(ContentHandlerhandler
); public ContentHandlergetContentHandler
( ); public voidsetErrorHandler
(ErrorHandlerhandler
); public ErrorHandlergetErrorHandler
( ); public voidparse
(StringsystemID
) throws IOException, SAXException; public voidparse
(InputSourceinput
) throws IOException, SAXException; // Implementation of org.xml.sax.DocumentHandler. public voidsetDocumentLocator
(Locatorlocator
); public voidstartDocument
( ) throws SAXException; public voidendDocument
( ) throws SAXException; public voidstartElement
(StringqualifiedName
, AttributeListqualifiedAttributes
) throws SAXException; public voidendElement
(StringqualifiedName
) throws SAXException; public void characters(char[ ]text
, intstart
, intlength
) throws SAXException; public voidignorableWhitespace
(char[ ]text
, intstart
, intlength
) throws SAXException; public voidprocessingInstruction
(Stringtarget
, Stringdata
) throws SAXException; }