- All Implemented Interfaces:
- ContentHandler,- DTDHandler,- EntityResolver,- ErrorHandler,- XMLFilter,- XMLReader
This class is designed to sit between an XMLReader and the client application's event handlers.  By default, it
 does nothing but pass requests up to the reader and events
 on to the handlers unmodified, but subclasses can override
 specific methods to modify the event stream or the configuration
 requests as they pass through.
- Since:
- 1.4, SAX 2.0
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct an empty XML filter, with no parent.XMLFilterImpl(XMLReader parent) Construct an XML filter with the specified parent.
- 
Method SummaryModifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) Filter a character data event.voidFilter an end document event.voidendElement(String uri, String localName, String qName) Filter an end element event.voidendPrefixMapping(String prefix) Filter an end Namespace prefix mapping event.voidFilter an error event.voidFilter a fatal error event.Get the content event handler.Get the current DTD event handler.Get the current entity resolver.Get the current error event handler.booleangetFeature(String name) Look up the value of a feature.Get the parent reader.getProperty(String name) Look up the value of a property.voidignorableWhitespace(char[] ch, int start, int length) Filter an ignorable whitespace event.voidnotationDecl(String name, String publicId, String systemId) Filter a notation declaration event.voidParse a document.voidparse(InputSource input) Parse a document.voidprocessingInstruction(String target, String data) Filter a processing instruction event.resolveEntity(String publicId, String systemId) Filter an external entity resolution.voidsetContentHandler(ContentHandler handler) Set the content event handler.voidsetDocumentLocator(Locator locator) Filter a new document locator event.voidsetDTDHandler(DTDHandler handler) Set the DTD event handler.voidsetEntityResolver(EntityResolver resolver) Set the entity resolver.voidsetErrorHandler(ErrorHandler handler) Set the error event handler.voidsetFeature(String name, boolean value) Set the value of a feature.voidSet the parent reader.voidsetProperty(String name, Object value) Set the value of a property.voidskippedEntity(String name) Filter a skipped entity event.voidFilter a start document event.voidstartElement(String uri, String localName, String qName, Attributes atts) Filter a start element event.voidstartPrefixMapping(String prefix, String uri) Filter a start Namespace prefix mapping event.voidunparsedEntityDecl(String name, String publicId, String systemId, String notationName) Filter an unparsed entity declaration event.voidFilter a warning event.Methods declared in class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface org.xml.sax.ContentHandlerdeclaration
- 
Constructor Details- 
XMLFilterImplpublic XMLFilterImpl()Construct an empty XML filter, with no parent.This filter will have no parent: you must assign a parent before you start a parse or do any configuration with setFeature or setProperty, unless you use this as a pure event consumer rather than as an XMLReader.- See Also:
 
- 
XMLFilterImplConstruct an XML filter with the specified parent.- Parameters:
- parent- the specified parent
- See Also:
 
 
- 
- 
Method Details- 
setParentSet the parent reader.This is the XMLReaderfrom which this filter will obtain its events and to which it will pass its configuration requests. The parent may itself be another filter.If there is no parent reader set, any attempt to parse or to set or get a feature or property will fail. 
- 
getParentGet the parent reader.
- 
setFeaturepublic void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException Set the value of a feature.This will always fail if the parent is null. - Specified by:
- setFeaturein interface- XMLReader
- Parameters:
- name- The feature name.
- value- The requested feature value.
- Throws:
- SAXNotRecognizedException- If the feature value can't be assigned or retrieved from the parent.
- SAXNotSupportedException- When the parent recognizes the feature name but cannot set the requested value.
- See Also:
 
- 
getFeatureLook up the value of a feature.This will always fail if the parent is null. - Specified by:
- getFeaturein interface- XMLReader
- Parameters:
- name- The feature name.
- Returns:
- The current value of the feature.
- Throws:
- SAXNotRecognizedException- If the feature value can't be assigned or retrieved from the parent.
- SAXNotSupportedException- When the parent recognizes the feature name but cannot determine its value at this time.
- See Also:
 
- 
setPropertypublic void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException Set the value of a property.This will always fail if the parent is null. - Specified by:
- setPropertyin interface- XMLReader
- Parameters:
- name- The property name.
- value- The requested property value.
- Throws:
- SAXNotRecognizedException- If the property value can't be assigned or retrieved from the parent.
- SAXNotSupportedException- When the parent recognizes the property name but cannot set the requested value.
 
- 
getPropertyLook up the value of a property.- Specified by:
- getPropertyin interface- XMLReader
- Parameters:
- name- The property name.
- Returns:
- The current value of the property.
- Throws:
- SAXNotRecognizedException- If the property value can't be assigned or retrieved from the parent.
- SAXNotSupportedException- When the parent recognizes the property name but cannot determine its value at this time.
- See Also:
 
- 
setEntityResolverSet the entity resolver.- Specified by:
- setEntityResolverin interface- XMLReader
- Parameters:
- resolver- The new entity resolver.
- See Also:
 
- 
getEntityResolverGet the current entity resolver.- Specified by:
- getEntityResolverin interface- XMLReader
- Returns:
- The current entity resolver, or null if none was set.
- See Also:
 
- 
setDTDHandlerSet the DTD event handler.- Specified by:
- setDTDHandlerin interface- XMLReader
- Parameters:
- handler- the new DTD handler
- See Also:
 
- 
getDTDHandlerGet the current DTD event handler.- Specified by:
- getDTDHandlerin interface- XMLReader
- Returns:
- The current DTD handler, or null if none was set.
- See Also:
 
- 
setContentHandlerSet the content event handler.- Specified by:
- setContentHandlerin interface- XMLReader
- Parameters:
- handler- the new content handler
- See Also:
 
- 
getContentHandlerGet the content event handler.- Specified by:
- getContentHandlerin interface- XMLReader
- Returns:
- The current content handler, or null if none was set.
- See Also:
 
- 
setErrorHandlerSet the error event handler.- Specified by:
- setErrorHandlerin interface- XMLReader
- Parameters:
- handler- the new error handler
- See Also:
 
- 
getErrorHandlerGet the current error event handler.- Specified by:
- getErrorHandlerin interface- XMLReader
- Returns:
- The current error handler, or null if none was set.
- See Also:
 
- 
parseParse a document.- Specified by:
- parsein interface- XMLReader
- Parameters:
- input- The input source for the document entity.
- Throws:
- SAXException- Any SAX exception, possibly wrapping another exception.
- IOException- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
- See Also:
 
- 
parseParse a document.- Specified by:
- parsein interface- XMLReader
- Parameters:
- systemId- The system identifier as a fully-qualified URI.
- Throws:
- SAXException- Any SAX exception, possibly wrapping another exception.
- IOException- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
- See Also:
 
- 
resolveEntityFilter an external entity resolution.- Specified by:
- resolveEntityin interface- EntityResolver
- Parameters:
- publicId- The entity's public identifier, or null.
- systemId- The entity's system identifier.
- Returns:
- A new InputSource or null for the default.
- Throws:
- SAXException- The client may throw an exception during processing.
- IOException- The client may throw an I/O-related exception while obtaining the new InputSource.
- See Also:
 
- 
notationDeclFilter a notation declaration event.- Specified by:
- notationDeclin interface- DTDHandler
- Parameters:
- name- The notation name.
- publicId- The notation's public identifier, or null.
- systemId- The notation's system identifier, or null.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
unparsedEntityDeclpublic void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException Filter an unparsed entity declaration event.- Specified by:
- unparsedEntityDeclin interface- DTDHandler
- Parameters:
- name- The entity name.
- publicId- The entity's public identifier, or null.
- systemId- The entity's system identifier, or null.
- notationName- The name of the associated notation.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
setDocumentLocatorFilter a new document locator event.- Specified by:
- setDocumentLocatorin interface- ContentHandler
- Parameters:
- locator- The document locator.
- See Also:
 
- 
startDocumentFilter a start document event.- Specified by:
- startDocumentin interface- ContentHandler
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
endDocumentFilter an end document event.- Specified by:
- endDocumentin interface- ContentHandler
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
startPrefixMappingFilter a start Namespace prefix mapping event.- Specified by:
- startPrefixMappingin interface- ContentHandler
- Parameters:
- prefix- The Namespace prefix.
- uri- The Namespace URI.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
endPrefixMappingFilter an end Namespace prefix mapping event.- Specified by:
- endPrefixMappingin interface- ContentHandler
- Parameters:
- prefix- The Namespace prefix.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
startElementpublic void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException Filter a start element event.- Specified by:
- startElementin interface- ContentHandler
- Parameters:
- uri- The element's Namespace URI, or the empty string.
- localName- The element's local name, or the empty string.
- qName- The element's qualified (prefixed) name, or the empty string.
- atts- The element's attributes.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
endElementFilter an end element event.- Specified by:
- endElementin interface- ContentHandler
- Parameters:
- uri- The element's Namespace URI, or the empty string.
- localName- The element's local name, or the empty string.
- qName- The element's qualified (prefixed) name, or the empty string.
- Throws:
- SAXException- The client may throw an exception during processing.
 
- 
charactersFilter a character data event.- Specified by:
- charactersin interface- ContentHandler
- Parameters:
- ch- An array of characters.
- start- The starting position in the array.
- length- The number of characters to use from the array.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
ignorableWhitespaceFilter an ignorable whitespace event.- Specified by:
- ignorableWhitespacein interface- ContentHandler
- Parameters:
- ch- An array of characters.
- start- The starting position in the array.
- length- The number of characters to use from the array.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
processingInstructionFilter a processing instruction event.- Specified by:
- processingInstructionin interface- ContentHandler
- Parameters:
- target- The processing instruction target.
- data- The text following the target.
- Throws:
- SAXException- The client may throw an exception during processing.
 
- 
skippedEntityFilter a skipped entity event.- Specified by:
- skippedEntityin interface- ContentHandler
- Parameters:
- name- The name of the skipped entity.
- Throws:
- SAXException- The client may throw an exception during processing.
 
- 
warningFilter a warning event.- Specified by:
- warningin interface- ErrorHandler
- Parameters:
- e- The warning as an exception.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
errorFilter an error event.- Specified by:
- errorin interface- ErrorHandler
- Parameters:
- e- The error as an exception.
- Throws:
- SAXException- The client may throw an exception during processing.
- See Also:
 
- 
fatalErrorFilter a fatal error event.- Specified by:
- fatalErrorin interface- ErrorHandler
- Parameters:
- e- The error as an exception.
- Throws:
- SAXException- The client may throw an exception during processing.
 
 
-