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 withNO WARRANTY.
This class is designed to sit between anXMLReader
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.
XMLFilter
,XMLReader
,EntityResolver
,DTDHandler
,ContentHandler
,ErrorHandler
XMLFilterImpl() Construct an empty XML filter, with no parent. | |
XMLFilterImpl(XMLReader parent) Construct an XML filter with the specified parent. |
characters(char[] ch, int start, int length) Filter a character data event. | |
endDocument() Filter an end document event. | |
endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) Filter an end element event. | |
endPrefixMapping(java.lang.String prefix) Filter an end Namespace prefix mapping event. | |
error(SAXParseException e) Filter an error event. | |
fatalError(SAXParseException e) Filter a fatal error event. | |
getContentHandler() Get the content event handler. | |
getDTDHandler() Get the current DTD event handler. | |
getEntityResolver() Get the current entity resolver. | |
getErrorHandler() Get the current error event handler. | |
getFeature(java.lang.String name) Look up the state of a feature. | |
getParent() Get the parent reader. | |
getProperty(java.lang.String name) Look up the value of a property. | |
ignorableWhitespace(char[] ch, int start, int length) Filter an ignorable whitespace event. | |
notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) Filter a notation declaration event. | |
parse(InputSource input) Parse a document. | |
parse(java.lang.String systemId) Parse a document. | |
processingInstruction(java.lang.String target, java.lang.String data) Filter a processing instruction event. | |
resolveEntity(java.lang.String publicId, java.lang.String systemId) Filter an external entity resolution. | |
setContentHandler(ContentHandler handler) Set the content event handler. | |
setDocumentLocator(Locator locator) Filter a new document locator event. | |
setDTDHandler(DTDHandler handler) Set the DTD event handler. | |
setEntityResolver(EntityResolver resolver) Set the entity resolver. | |
setErrorHandler(ErrorHandler handler) Set the error event handler. | |
setFeature(java.lang.String name, boolean state) Set the state of a feature. | |
setParent(XMLReader parent) Set the parent reader. | |
setProperty(java.lang.String name, java.lang.Object value) Set the value of a property. | |
skippedEntity(java.lang.String name) Filter a skipped entity event. | |
startDocument() Filter a start document event. | |
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName,Attributes atts) Filter a start element event. | |
startPrefixMapping(java.lang.String prefix, java.lang.String uri) Filter a start Namespace prefix mapping event. | |
unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) Filter an unparsed entity declaration event. | |
warning(SAXParseException e) Filter a warning event. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
publicXMLFilterImpl()
This filter will have no parent: you must assign a parent before you start a parse or do any configuration with setFeature or setProperty.
XMLReader.setFeature(java.lang.String, boolean)
,XMLReader.setProperty(java.lang.String, java.lang.Object)
publicXMLFilterImpl(XMLReader parent)
setParent(org.xml.sax.XMLReader)
,getParent()
public voidsetParent(XMLReader parent)
This is theXMLReader
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.
setParent
in interfaceXMLFilter
parent
- The parent XML reader.java.lang.NullPointerException
- If the parent is null.getParent()
publicXMLReadergetParent()
getParent
in interfaceXMLFilter
setParent(org.xml.sax.XMLReader)
public voidsetFeature(java.lang.String name, boolean state) throwsSAXNotRecognizedException,SAXNotSupportedException
This will always fail if the parent is null.
setFeature
in interfaceXMLReader
name
- The feature name.state
- The requested feature state.SAXNotRecognizedException
- When the XMLReader does not recognize the feature name.SAXNotSupportedException
- When the XMLReader recognizes the feature name but cannot set the requested value.XMLReader.setFeature(java.lang.String, boolean)
public booleangetFeature(java.lang.String name) throwsSAXNotRecognizedException,SAXNotSupportedException
This will always fail if the parent is null.
getFeature
in interfaceXMLReader
name
- The feature name.SAXNotRecognizedException
- When the XMLReader does not recognize the feature name.SAXNotSupportedException
- When the XMLReader recognizes the feature name but cannot determine its state at this time.XMLReader.getFeature(java.lang.String)
public voidsetProperty(java.lang.String name, java.lang.Object value) throwsSAXNotRecognizedException,SAXNotSupportedException
This will always fail if the parent is null.
setProperty
in interfaceXMLReader
name
- The property name.state
- The requested property value.SAXNotRecognizedException
- When the XMLReader does not recognize the property name.SAXNotSupportedException
- When the XMLReader recognizes the property name but cannot set the requested value.XMLReader.setProperty(java.lang.String, java.lang.Object)
public java.lang.ObjectgetProperty(java.lang.String name) throwsSAXNotRecognizedException,SAXNotSupportedException
getProperty
in interfaceXMLReader
name
- The property name.SAXNotRecognizedException
- When the XMLReader does not recognize the feature name.SAXNotSupportedException
- When the XMLReader recognizes the property name but cannot determine its value at this time.XMLReader.setFeature(java.lang.String, boolean)
public voidsetEntityResolver(EntityResolver resolver)
setEntityResolver
in interfaceXMLReader
resolver
- The new entity resolver.java.lang.NullPointerException
- If the resolver is null.XMLReader.setEntityResolver(org.xml.sax.EntityResolver)
publicEntityResolvergetEntityResolver()
getEntityResolver
in interfaceXMLReader
XMLReader.getEntityResolver()
public voidsetDTDHandler(DTDHandler handler)
setDTDHandler
in interfaceXMLReader
resolver
- The new DTD handler.java.lang.NullPointerException
- If the handler is null.XMLReader.setDTDHandler(org.xml.sax.DTDHandler)
publicDTDHandlergetDTDHandler()
getDTDHandler
in interfaceXMLReader
XMLReader.getDTDHandler()
public voidsetContentHandler(ContentHandler handler)
setContentHandler
in interfaceXMLReader
resolver
- The new content handler.java.lang.NullPointerException
- If the handler is null.XMLReader.setContentHandler(org.xml.sax.ContentHandler)
publicContentHandlergetContentHandler()
getContentHandler
in interfaceXMLReader
XMLReader.getContentHandler()
public voidsetErrorHandler(ErrorHandler handler)
setErrorHandler
in interfaceXMLReader
handle
- The new error handler.java.lang.NullPointerException
- If the handler is null.XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
publicErrorHandlergetErrorHandler()
getErrorHandler
in interfaceXMLReader
XMLReader.getErrorHandler()
public voidparse(InputSource input) throwsSAXException, java.io.IOException
parse
in interfaceXMLReader
input
- The input source for the document entity.SAXException
- Any SAX exception, possibly wrapping another exception.java.io.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.XMLReader.parse(org.xml.sax.InputSource)
public voidparse(java.lang.String systemId) throwsSAXException, java.io.IOException
parse
in interfaceXMLReader
systemId
- The system identifier as a fully-qualified URI.SAXException
- Any SAX exception, possibly wrapping another exception.java.io.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.XMLReader.parse(java.lang.String)
publicInputSourceresolveEntity(java.lang.String publicId, java.lang.String systemId) throwsSAXException, java.io.IOException
resolveEntity
in interfaceEntityResolver
publicId
- The entity's public identifier, or null.systemId
- The entity's system identifier.SAXException
- The client may throw an exception during processing.java.io.IOException
- The client may throw an I/O-related exception while obtaining the new InputSource.EntityResolver.resolveEntity(java.lang.String, java.lang.String)
public voidnotationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throwsSAXException
notationDecl
in interfaceDTDHandler
name
- The notation name.publicId
- The notation's public identifier, or null.systemId
- The notation's system identifier, or null.SAXException
- The client may throw an exception during processing.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public voidunparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throwsSAXException
unparsedEntityDecl
in interfaceDTDHandler
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.SAXException
- The client may throw an exception during processing.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public voidsetDocumentLocator(Locator locator)
setDocumentLocator
in interfaceContentHandler
locator
- The document locator.ContentHandler.setDocumentLocator(org.xml.sax.Locator)
public voidstartDocument() throwsSAXException
startDocument
in interfaceContentHandler
SAXException
- The client may throw an exception during processing.ContentHandler.startDocument()
public voidendDocument() throwsSAXException
endDocument
in interfaceContentHandler
SAXException
- The client may throw an exception during processing.ContentHandler.endDocument()
public voidstartPrefixMapping(java.lang.String prefix, java.lang.String uri) throwsSAXException
startPrefixMapping
in interfaceContentHandler
prefix
- The Namespace prefix.uri
- The Namespace URI.SAXException
- The client may throw an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public voidendPrefixMapping(java.lang.String prefix) throwsSAXException
endPrefixMapping
in interfaceContentHandler
prefix
- The Namespace prefix.SAXException
- The client may throw an exception during processing.ContentHandler.endPrefixMapping(java.lang.String)
public voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName,Attributes atts) throwsSAXException
startElement
in interfaceContentHandler
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.SAXException
- The client may throw an exception during processing.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throwsSAXException
endElement
in interfaceContentHandler
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.SAXException
- The client may throw an exception during processing.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public voidcharacters(char[] ch, int start, int length) throwsSAXException
characters
in interfaceContentHandler
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.SAXException
- The client may throw an exception during processing.ContentHandler.characters(char[], int, int)
public voidignorableWhitespace(char[] ch, int start, int length) throwsSAXException
ignorableWhitespace
in interfaceContentHandler
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.SAXException
- The client may throw an exception during processing.ContentHandler.ignorableWhitespace(char[], int, int)
public voidprocessingInstruction(java.lang.String target, java.lang.String data) throwsSAXException
processingInstruction
in interfaceContentHandler
target
- The processing instruction target.data
- The text following the target.SAXException
- The client may throw an exception during processing.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public voidskippedEntity(java.lang.String name) throwsSAXException
skippedEntity
in interfaceContentHandler
name
- The name of the skipped entity.SAXException
- The client may throw an exception during processing.ContentHandler.skippedEntity(java.lang.String)
public voidwarning(SAXParseException e) throwsSAXException
warning
in interfaceErrorHandler
e
- The nwarning as an exception.SAXException
- The client may throw an exception during processing.ErrorHandler.warning(org.xml.sax.SAXParseException)
public voiderror(SAXParseException e) throwsSAXException
error
in interfaceErrorHandler
e
- The error as an exception.SAXException
- The client may throw an exception during processing.ErrorHandler.error(org.xml.sax.SAXParseException)
public voidfatalError(SAXParseException e) throwsSAXException
fatalError
in interfaceErrorHandler
e
- The error as an exception.SAXException
- The client may throw an exception during processing.ErrorHandler.fatalError(org.xml.sax.SAXParseException)