public class XMLFilterImpl extends Object implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
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.
XMLFilter,
XMLReader,
EntityResolver,
DTDHandler,
ContentHandler,
ErrorHandler| Constructor and Description |
|---|
XMLFilterImpl()
Construct an empty XML filter, with no parent.
|
XMLFilterImpl(XMLReader parent)
Construct an XML filter with the specified parent.
|
| Modifier and Type | Method and Description |
|---|---|
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(InputSource input)
Parse a document.
|
void |
parse(String systemId)
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 |
setDocumentLocator(Locator locator)
Filter a new document locator event.
|
void |
setDTDHandler(DTDHandler handler)
Set the DTD event handler.
|
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.
|
public XMLFilterImpl()
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.
public XMLFilterImpl(XMLReader parent)
setParent(org.xml.sax.XMLReader),
getParent()public void setParent(XMLReader parent)
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.
setParent in interface XMLFilterparent - The parent XML reader.getParent()public XMLReader getParent()
getParent in interface XMLFiltersetParent(org.xml.sax.XMLReader)public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
setFeature in interface XMLReaderSAXNotRecognizedException - 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.name - The feature name.value - The requested feature value.XMLReader.getFeature(java.lang.String)public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
getFeature in interface XMLReaderSAXNotRecognizedException - 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.name - The feature name.XMLReader.setFeature(java.lang.String, boolean)public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
setProperty in interface XMLReaderSAXNotRecognizedException - 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.name - The property name.value - The requested property value.public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty in interface XMLReaderSAXNotRecognizedException - 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.name - The property name.XMLReader.setProperty(java.lang.String, java.lang.Object)public void setEntityResolver(EntityResolver resolver)
setEntityResolver in interface XMLReaderresolver - The new entity resolver.XMLReader.getEntityResolver()public EntityResolver getEntityResolver()
getEntityResolver in interface XMLReaderXMLReader.setEntityResolver(org.xml.sax.EntityResolver)public void setDTDHandler(DTDHandler handler)
setDTDHandler in interface XMLReaderhandler - the new DTD handlerXMLReader.getDTDHandler()public DTDHandler getDTDHandler()
getDTDHandler in interface XMLReaderXMLReader.setDTDHandler(org.xml.sax.DTDHandler)public void setContentHandler(ContentHandler handler)
setContentHandler in interface XMLReaderhandler - the new content handlerXMLReader.getContentHandler()public ContentHandler getContentHandler()
getContentHandler in interface XMLReaderXMLReader.setContentHandler(org.xml.sax.ContentHandler)public void setErrorHandler(ErrorHandler handler)
setErrorHandler in interface XMLReaderhandler - the new error handlerXMLReader.getErrorHandler()public ErrorHandler getErrorHandler()
getErrorHandler in interface XMLReaderXMLReader.setErrorHandler(org.xml.sax.ErrorHandler)public void parse(InputSource input) throws SAXException, IOException
parse in interface XMLReaderSAXException - 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.input - The input source for the document entity.InputSource,
XMLReader.parse(java.lang.String),
XMLReader.setEntityResolver(org.xml.sax.EntityResolver),
XMLReader.setDTDHandler(org.xml.sax.DTDHandler),
XMLReader.setContentHandler(org.xml.sax.ContentHandler),
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)public void parse(String systemId) throws SAXException, IOException
parse in interface XMLReaderSAXException - 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.systemId - The system identifier as a fully-qualified URI.XMLReader.parse(org.xml.sax.InputSource)public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
resolveEntity in interface EntityResolverSAXException - The client may throw
an exception during processing.IOException - The client may throw an
I/O-related exception while obtaining the
new InputSource.publicId - The entity's public identifier, or null.systemId - The entity's system identifier.InputSourcepublic void notationDecl(String name, String publicId, String systemId) throws SAXException
notationDecl in interface DTDHandlerSAXException - The client may throw
an exception during processing.name - The notation name.publicId - The notation's public identifier, or null.systemId - The notation's system identifier, or null.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String),
Attributespublic void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
unparsedEntityDecl in interface DTDHandlerSAXException - The client may throw
an exception during processing.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.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String),
Attributespublic void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlerlocator - The document locator.Locatorpublic void startDocument()
throws SAXException
startDocument in interface ContentHandlerSAXException - The client may throw
an exception during processing.ContentHandler.endDocument()public void endDocument()
throws SAXException
endDocument in interface ContentHandlerSAXException - The client may throw
an exception during processing.ContentHandler.startDocument()public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping in interface ContentHandlerSAXException - The client may throw
an exception during processing.prefix - The Namespace prefix.uri - The Namespace URI.ContentHandler.endPrefixMapping(java.lang.String),
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping in interface ContentHandlerSAXException - The client may throw
an exception during processing.prefix - The Namespace prefix.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String),
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement in interface ContentHandlerSAXException - The client may throw
an exception during processing.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.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String),
Attributes,
AttributesImplpublic void endElement(String uri, String localName, String qName) throws SAXException
endElement in interface ContentHandlerSAXException - The client may throw
an exception during processing.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.public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlerSAXException - The client may throw
an exception during processing.ch - An array of characters.start - The starting position in the array.length - The number of characters to use from the array.ContentHandler.ignorableWhitespace(char[], int, int),
Locatorpublic void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerSAXException - The client may throw
an exception during processing.ch - An array of characters.start - The starting position in the array.length - The number of characters to use from the array.ContentHandler.characters(char[], int, int)public void processingInstruction(String target, String data) throws SAXException
processingInstruction in interface ContentHandlerSAXException - The client may throw
an exception during processing.target - The processing instruction target.data - The text following the target.public void skippedEntity(String name) throws SAXException
skippedEntity in interface ContentHandlerSAXException - The client may throw
an exception during processing.name - The name of the skipped entity.public void warning(SAXParseException e) throws SAXException
warning in interface ErrorHandlerSAXException - The client may throw
an exception during processing.e - The warning as an exception.SAXParseExceptionpublic void error(SAXParseException e) throws SAXException
error in interface ErrorHandlerSAXException - The client may throw
an exception during processing.e - The error as an exception.SAXParseExceptionpublic void fatalError(SAXParseException e) throws SAXException
fatalError in interface ErrorHandlerSAXException - The client may throw
an exception during processing.e - The error as an exception.SAXParseExceptionaicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2024 aicas GmbH. All Rights Reserved.