| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class XMLFilterImpl extends Object implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
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 {@link org.xml.sax.XMLReader 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.
Constructor Summary | |
---|---|
Construct an empty XML filter, with no parent. |
|
XMLFilterImpl(XMLReader parent) Construct an XML filter with the specified parent. |
Method Summary | |
---|---|
void |
characters(char[] ch, int start, int length) Filter a character data event. |
void |
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 |
Filter an error event. |
void |
Filter a fatal error event. |
ContentHandler |
Get the content event handler. |
DTDHandler |
Get the current DTD event handler. |
EntityResolver |
Get the current entity resolver. |
ErrorHandler |
Get the current error event handler. |
boolean |
getFeature(String name) Look up the value of a feature. |
XMLReader |
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 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 |
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 |
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 |
Filter a warning event. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 {@link XMLReader}.
public XMLFilterImpl(XMLReader parent)
parent
Method Detail |
---|
public void characters(char[] ch, int start, int length) throws SAXException
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.public void endDocument() throws SAXException
SAXException
- The client may throw
an exception during processing.public void endElement(String uri, String localName, String qName) throws SAXException
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.public void endPrefixMapping(String prefix) throws SAXException
prefix
- The Namespace prefix.SAXException
- The client may throw
an exception during processing.public void error(SAXParseException e) throws SAXException
e
- The error as an exception.SAXException
- The client may throw
an exception during processing.public void fatalError(SAXParseException e) throws SAXException
e
- The error as an exception.SAXException
- The client may throw
an exception during processing.public ContentHandler getContentHandler()
public DTDHandler getDTDHandler()
public EntityResolver getEntityResolver()
public ErrorHandler getErrorHandler()
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
name
- The feature name.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.public XMLReader getParent()
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
name
- The property name.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.public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
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.public void notationDecl(String name, String publicId, String systemId) throws SAXException
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.public void parse(InputSource input) throws SAXException, IOException
input
- The input source for the document entity.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.public void parse(String systemId) throws SAXException, IOException
systemId
- The system identifier as a fully-qualified URI.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.public void processingInstruction(String target, String data) throws SAXException
target
- The processing instruction target.data
- The text following the target.SAXException
- The client may throw
an exception during processing.public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
publicId
- The entity's public identifier, or null.systemId
- The entity's system identifier.SAXException
- The client may throw
an exception during processing.IOException
- The client may throw an
I/O-related exception while obtaining the
new InputSource.public void setContentHandler(ContentHandler handler)
handler
- the new content handlerpublic void setDocumentLocator(Locator locator)
locator
- The document locator.public void setDTDHandler(DTDHandler handler)
handler
- the new DTD handlerpublic void setEntityResolver(EntityResolver resolver)
resolver
- The new entity resolver.public void setErrorHandler(ErrorHandler handler)
handler
- the new error handlerpublic void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
name
- The feature name.value
- The requested feature value.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.public void setParent(XMLReader parent)
This is the {@link org.xml.sax.XMLReader 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.
parent
- The parent XML reader.public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
This will always fail if the parent is null.
name
- The property name.value
- The requested property value.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.public void skippedEntity(String name) throws SAXException
name
- The name of the skipped entity.SAXException
- The client may throw
an exception during processing.public void startDocument() throws SAXException
SAXException
- The client may throw
an exception during processing.public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
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.public void startPrefixMapping(String prefix, String uri) throws SAXException
prefix
- The Namespace prefix.uri
- The Namespace URI.SAXException
- The client may throw
an exception during processing.public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
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.public void warning(SAXParseException e) throws SAXException
e
- The warning as an exception.SAXException
- The client may throw
an exception during processing.
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |