The XMLFilterImpl Class
XMLFilterImpl
is
invaluable for implementing XML filters correctly. An instance of
this class sits between an XMLReader
and the client application's
event handlers. It receives messages from the reader and passes
them to the application unchanged, and vice versa. However, by
subclassing this class and overriding particular methods, you can
change the events that are sent before the application gets to see
them. You chain a filter to an XMLReader
by passing the reader as an
argument to the filter's constructor. When parsing, you invoke the
filter's parse( )
method, not
the reader's parse( )
method.
package org.xml.sax.helpers; public classXMLFilterImpl
implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler { publicXMLFilterImpl
( ); publicXMLFilterImpl
(XMLReaderparent
); // Implementation of org.xml.sax.XMLFilter public voidsetParent
(XMLReaderparent
); public XMLReadergetParent
( ); // 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
(InputSourceinput
) throws SAXException, IOException; public voidparse
(StringsystemID
) throws SAXException, IOException // Implementation of org.xml.sax.EntityResolver public InputSourceresolveEntity
(StringpublicID
, StringsystemID
) throws SAXException, IOException; // Implementation of org.xml.sax.DTDHandler public voidnotationDecl
(Stringname
, StringpublicID
, StringsystemID
) throws SAXException; public voidunparsedEntityDecl
(Stringname
, StringpublicID
, StringsystemID
, StringnotationName
) throws SAXException; // Implementation of org.xml.sax.ContentHandler public voidsetDocumentLocator
(Locatorlocator
); public voidstartDocument
( ) throws SAXException; public voidendDocument
( ) throws SAXException; public voidstartPrefixMapping
(Stringprefix
, Stringuri
) throws SAXException; public voidendPrefixMapping
(Stringprefix
) throws SAXException; public voidstartElement
(StringnamespaceURI
, StringlocalName
, StringqualifiedName
, Attributesatts
) throws SAXException; public voidendElement
(StringnamespaceURI
, StringlocalName
, StringqualifiedName
) throws SAXException; public voidcharacters
(char[ ]text
, intstart
, intlength
) throws SAXException; public voidignorableWhitespace
(char[ ]text
, intstart
, intlength
) throws SAXException; public voidprocessingInstruction
(Stringtarget
, Stringdata
) throws SAXException; public voidskippedEntity
(Stringname
) throws SAXException; // Implementation of org.xml.sax.ErrorHandler public voidwarning
(SAXParseExceptionex
) throws SAXException; public voiderror
(SAXParseExceptionex
) throws SAXException; public voidfatalError
(SAXParseExceptionex
) throws SAXException; }