Most visited

Recently visited

Added in API level 1

XMLFilterImpl

public class XMLFilterImpl
extends Object implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler

java.lang.Object
   ↳ org.xml.sax.helpers.XMLFilterImpl


Base class for deriving an XML filter.

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 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.

See also:

Summary

Public constructors

XMLFilterImpl()

Construct an empty XML filter, with no parent.

XMLFilterImpl(XMLReader parent)

Construct an XML filter with the specified parent.

Public methods

void characters(char[] ch, int start, int length)

Filter a character data event.

void endDocument()

Filter an end document event.

void endElement(String uri, String localName, String qName)

Filter an end element event.

void endPrefixMapping(String prefix)

Filter an end Namespace prefix mapping event.

void error(SAXParseException e)

Filter an error event.

void fatalError(SAXParseException e)

Filter a fatal error event.

ContentHandler getContentHandler()

Get the content event handler.

DTDHandler getDTDHandler()

Get the current DTD event handler.

EntityResolver getEntityResolver()

Get the current entity resolver.

ErrorHandler getErrorHandler()

Get the current error event handler.

boolean getFeature(String name)

Look up the value of a feature.

XMLReader getParent()

Get the parent reader.

Object getProperty(String name)

Look up the value of a property.

void ignorableWhitespace(char[] ch, int start, int length)

Filter an ignorable whitespace event.

void notationDecl(String name, String publicId, String systemId)

Filter a notation declaration event.

void parse(String systemId)

Parse a document.

void parse(InputSource input)

Parse a document.

void processingInstruction(String target, String data)

Filter a processing instruction event.

InputSource resolveEntity(String publicId, String systemId)

Filter an external entity resolution.

void setContentHandler(ContentHandler handler)

Set the content event handler.

void setDTDHandler(DTDHandler handler)

Set the DTD event handler.

void setDocumentLocator(Locator locator)

Filter a new document locator event.

void setEntityResolver(EntityResolver resolver)

Set the entity resolver.

void setErrorHandler(ErrorHandler handler)

Set the error event handler.

void setFeature(String name, boolean value)

Set the value of a feature.

void setParent(XMLReader parent)

Set the parent reader.

void setProperty(String name, Object value)

Set the value of a property.

void skippedEntity(String name)

Filter a skipped entity event.

void startDocument()

Filter a start document event.

void startElement(String uri, String localName, String qName, Attributes atts)

Filter a start element event.

void startPrefixMapping(String prefix, String uri)

Filter a start Namespace prefix mapping event.

void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)

Filter an unparsed entity declaration event.

void warning(SAXParseException e)

Filter a warning event.

Inherited methods

From class java.lang.Object
From interface org.xml.sax.XMLFilter
From interface org.xml.sax.EntityResolver
From interface org.xml.sax.DTDHandler
From interface org.xml.sax.ContentHandler
From interface org.xml.sax.ErrorHandler
From interface org.xml.sax.XMLReader

Public constructors

XMLFilterImpl

Added in API level 1
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:

XMLFilterImpl

Added in API level 1
XMLFilterImpl (XMLReader parent)

Construct an XML filter with the specified parent.

Parameters
parent XMLReader: the XML reader from which this filter receives its events.

See also:

Public methods

characters

Added in API level 1
void characters (char[] ch, 
                int start, 
                int length)

Filter a character data event.

Parameters
ch char: An array of characters.
start int: The starting position in the array.
length int: The number of characters to use from the array.
Throws
SAXException The client may throw an exception during processing.

endDocument

Added in API level 1
void endDocument ()

Filter an end document event.

Throws
SAXException The client may throw an exception during processing.

endElement

Added in API level 1
void endElement (String uri, 
                String localName, 
                String qName)

Filter an end element event.

Parameters
uri String: The element's Namespace URI, or the empty string.
localName String: The element's local name, or the empty string.
qName String: The element's qualified (prefixed) name, or the empty string.
Throws
SAXException The client may throw an exception during processing.

endPrefixMapping

Added in API level 1
void endPrefixMapping (String prefix)

Filter an end Namespace prefix mapping event.

Parameters
prefix String: The Namespace prefix.
Throws
SAXException The client may throw an exception during processing.

error

Added in API level 1
void error (SAXParseException e)

Filter an error event.

Parameters
e SAXParseException: The error as an exception.
Throws
SAXException The client may throw an exception during processing.

fatalError

Added in API level 1
void fatalError (SAXParseException e)

Filter a fatal error event.

Parameters
e SAXParseException: The error as an exception.
Throws
SAXException The client may throw an exception during processing.

getContentHandler

Added in API level 1
ContentHandler getContentHandler ()

Get the content event handler.

Returns
ContentHandler The current content handler, or null if none was set.

getDTDHandler

Added in API level 1
DTDHandler getDTDHandler ()

Get the current DTD event handler.

Returns
DTDHandler The current DTD handler, or null if none was set.

getEntityResolver

Added in API level 1
EntityResolver getEntityResolver ()

Get the current entity resolver.

Returns
EntityResolver The current entity resolver, or null if none was set.

getErrorHandler

Added in API level 1
ErrorHandler getErrorHandler ()

Get the current error event handler.

Returns
ErrorHandler The current error handler, or null if none was set.

getFeature

Added in API level 1
boolean getFeature (String name)

Look up the value of a feature.

This will always fail if the parent is null.

Parameters
name String: The feature name.
Returns
boolean 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.

getParent

Added in API level 1
XMLReader getParent ()

Get the parent reader.

Returns
XMLReader The parent XML reader, or null if none is set.

See also:

getProperty

Added in API level 1
Object getProperty (String name)

Look up the value of a property.

Parameters
name String: The property name.
Returns
Object 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.

ignorableWhitespace

Added in API level 1
void ignorableWhitespace (char[] ch, 
                int start, 
                int length)

Filter an ignorable whitespace event.

Parameters
ch char: An array of characters.
start int: The starting position in the array.
length int: The number of characters to use from the array.
Throws
SAXException The client may throw an exception during processing.

notationDecl

Added in API level 1
void notationDecl (String name, 
                String publicId, 
                String systemId)

Filter a notation declaration event.

Parameters
name String: The notation name.
publicId String: The notation's public identifier, or null.
systemId String: The notation's system identifier, or null.
Throws
SAXException The client may throw an exception during processing.

parse

Added in API level 1
void parse (String systemId)

Parse a document.

Parameters
systemId String: 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.

parse

Added in API level 1
void parse (InputSource input)

Parse a document.

Parameters
input InputSource: 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.

processingInstruction

Added in API level 1
void processingInstruction (String target, 
                String data)

Filter a processing instruction event.

Parameters
target String: The processing instruction target.
data String: The text following the target.
Throws
SAXException The client may throw an exception during processing.

resolveEntity

Added in API level 1
InputSource resolveEntity (String publicId, 
                String systemId)

Filter an external entity resolution.

Parameters
publicId String: The entity's public identifier, or null.
systemId String: The entity's system identifier.
Returns
InputSource 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.

setContentHandler

Added in API level 1
void setContentHandler (ContentHandler handler)

Set the content event handler.

Parameters
handler ContentHandler: the new content handler

setDTDHandler

Added in API level 1
void setDTDHandler (DTDHandler handler)

Set the DTD event handler.

Parameters
handler DTDHandler: the new DTD handler

setDocumentLocator

Added in API level 1
void setDocumentLocator (Locator locator)

Filter a new document locator event.

Parameters
locator Locator: The document locator.

setEntityResolver

Added in API level 1
void setEntityResolver (EntityResolver resolver)

Set the entity resolver.

Parameters
resolver EntityResolver: The new entity resolver.

setErrorHandler

Added in API level 1
void setErrorHandler (ErrorHandler handler)

Set the error event handler.

Parameters
handler ErrorHandler: the new error handler

setFeature

Added in API level 1
void setFeature (String name, 
                boolean value)

Set the value of a feature.

This will always fail if the parent is null.

Parameters
name String: The feature name.
value boolean: 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.

setParent

Added in API level 1
void setParent (XMLReader parent)

Set the parent reader.

This is the XMLReader from 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.

Parameters
parent XMLReader: The parent XML reader.

See also:

setProperty

Added in API level 1
void setProperty (String name, 
                Object value)

Set the value of a property.

This will always fail if the parent is null.

Parameters
name String: The property name.
value Object: 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.

skippedEntity

Added in API level 1
void skippedEntity (String name)

Filter a skipped entity event.

Parameters
name String: The name of the skipped entity.
Throws
SAXException The client may throw an exception during processing.

startDocument

Added in API level 1
void startDocument ()

Filter a start document event.

Throws
SAXException The client may throw an exception during processing.

startElement

Added in API level 1
void startElement (String uri, 
                String localName, 
                String qName, 
                Attributes atts)

Filter a start element event.

Parameters
uri String: The element's Namespace URI, or the empty string.
localName String: The element's local name, or the empty string.
qName String: The element's qualified (prefixed) name, or the empty string.
atts Attributes: The element's attributes.
Throws
SAXException The client may throw an exception during processing.

startPrefixMapping

Added in API level 1
void startPrefixMapping (String prefix, 
                String uri)

Filter a start Namespace prefix mapping event.

Parameters
prefix String: The Namespace prefix.
uri String: The Namespace URI.
Throws
SAXException The client may throw an exception during processing.

unparsedEntityDecl

Added in API level 1
void unparsedEntityDecl (String name, 
                String publicId, 
                String systemId, 
                String notationName)

Filter an unparsed entity declaration event.

Parameters
name String: The entity name.
publicId String: The entity's public identifier, or null.
systemId String: The entity's system identifier, or null.
notationName String: The name of the associated notation.
Throws
SAXException The client may throw an exception during processing.

warning

Added in API level 1
void warning (SAXParseException e)

Filter a warning event.

Parameters
e SAXParseException: The warning as an exception.
Throws
SAXException The client may throw an exception during processing.

Hooray!