|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.aliasi.xml.SimpleElementHandler
com.aliasi.xml.SAXFilterHandler
public class SAXFilterHandler
The SAXFilterHandler provides a base class for
filtering SAX handlers. A SAX filter handler behaves like other
output stream filters such as FilterOutputStream.
A filter acts as a container for a handler, which may be supplied
at construction time or set. The filter typically receives SAX
events and processes them in some way before passing them to the
contained handler. This particular filter implements the content
handler component of XMLFilterImpl.
The contained
handler may be changed with setHandler(DefaultHandler),
thus allowing reuse of filters. The implementation of all methods
in this class delegates the methods to the contained handler, so an
extending class need only implement the handler methods that it
would like to filter. The contained handler is protected and may
be accessed directly by subclasses; its methods may be accessed
through super.
Warning: The Sun JDK 1.4.2 implementation of DefaultHandler is defective in not declaring an IOException to be thrown by DefaultHandler.resolveEntity(String,String). See the method
documentation for resolveEntity(String,String) for a
description of this class's implemented workaround.
| Field Summary | |
|---|---|
protected DefaultHandler |
mHandler
The contained default handler to which events are delegated by default. |
| Fields inherited from class com.aliasi.xml.SimpleElementHandler |
|---|
CDATA_ATTS_TYPE, EMPTY_ATTS, NO_OP_DEFAULT_HANDLER |
| Constructor Summary | |
|---|---|
SAXFilterHandler()
Construct a filter handler that contains the no-op handler SimpleElementHandler.NO_OP_DEFAULT_HANDLER. |
|
SAXFilterHandler(DefaultHandler handler)
Construct a filter handler with the specified contained handler. |
|
| Method Summary | |
|---|---|
void |
characters(char[] ch,
int start,
int length)
Call delegated to mHandler. |
void |
endDocument()
Call delegated to mHandler. |
void |
endElement(String namespaceURI,
String localName,
String qName)
Call delegated to mHandler. |
void |
endPrefixMapping(String prefix)
Call delegated to mHandler. |
void |
error(SAXParseException exception)
Call delegated to mHandler. |
void |
fatalError(SAXParseException exception)
Call delegated to mHandler. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Call delegated to mHandler. |
void |
notationDecl(String name,
String publicId,
String systemId)
Call delegated to mHandler. |
void |
processingInstruction(String target,
String data)
Call delegated to mHandler. |
InputSource |
resolveEntity(String publicId,
String systemId)
Call delegated to mHandler. |
void |
setDocumentLocator(Locator locator)
Call delegated to mHandler. |
void |
setHandler(DefaultHandler handler)
Sets the contained handler to the specified value. |
void |
skippedEntity(String name)
Call delegated to mHandler. |
void |
startDocument()
Call delegated to mHandler. |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
Call delegated to mHandler. |
void |
startPrefixMapping(String prefix,
String uri)
Call delegated to mHandler. |
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
Call delegated to mHandler. |
void |
warning(SAXParseException exception)
Call delegated to mHandler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected DefaultHandler mHandler
super invocations.
| Constructor Detail |
|---|
public SAXFilterHandler(DefaultHandler handler)
handler - The handler to be contained by the constructed
filter.public SAXFilterHandler()
SimpleElementHandler.NO_OP_DEFAULT_HANDLER.
| Method Detail |
|---|
public void setHandler(DefaultHandler handler)
public void startDocument()
throws SAXException
mHandler.
startDocument in interface ContentHandlerstartDocument in class DefaultHandlerSAXException - if the contained hanlder throws a SAX
exception.
public void endDocument()
throws SAXException
mHandler.
endDocument in interface ContentHandlerendDocument in class DefaultHandlerSAXException - if the contained hanlder throws a SAX
exception.
public void startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException
mHandler.
startElement in interface ContentHandlerstartElement in class DefaultHandlernamespaceURI - The URI identifying the name space, or
null if there isn't one.localName - Local name of element.qName - Qualified name of element, which is prefixed with
the name space URI and a colon if it is non-null, and is equal
to local name if there is no name space specified.atts - Attributes for this element.
SAXException - if the contained hanlder throws a SAX
exception.
public void endElement(String namespaceURI,
String localName,
String qName)
throws SAXException
mHandler.
endElement in interface ContentHandlerendElement in class DefaultHandlernamespaceURI - The URI identifying the name space, or
null if there isn't one.localName - Local name of element.qName - Qualified name of element, which is prefixed with
the name space URI and a colon if it is non-null, and is equal
to local name if there is no name space specified.
SAXException - if the contained hanlder throws a SAX
exception.
public void characters(char[] ch,
int start,
int length)
throws SAXException
mHandler.
characters in interface ContentHandlercharacters in class DefaultHandlerch - Character array containing characters to handle.start - Index of first character to handle.length - Number of characters to handle.
SAXException - if the contained hanlder throws a SAX
exception.
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
mHandler.
ignorableWhitespace in interface ContentHandlerignorableWhitespace in class DefaultHandlerch - Character array containing characters to handle.start - Index of first character to handle.length - Number of characters to handle.
SAXException - if the contained hanlder throws a SAX
exception.
public void processingInstruction(String target,
String data)
throws SAXException
mHandler.
processingInstruction in interface ContentHandlerprocessingInstruction in class DefaultHandlertarget - The processing instruction target.data - The processing instruction data, or
null if none is supplied.
SAXException - if the contained hanlder throws a SAX
exception.
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
mHandler.
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class DefaultHandlerprefix - The namespace prefix being declared.uri - The namespace URI mapped to the prefix.
SAXException - if the contained hanlder throws a SAX
exception.
public void endPrefixMapping(String prefix)
throws SAXException
mHandler.
endPrefixMapping in interface ContentHandlerendPrefixMapping in class DefaultHandlerprefix - The namespace prefix being declared.
SAXException - if the contained hanlder throws a SAX
exception.
public void skippedEntity(String name)
throws SAXException
mHandler.
skippedEntity in interface ContentHandlerskippedEntity in class DefaultHandlername - The name of the skipped entity.
SAXException - if the contained hanlder throws a SAX
exception.public void setDocumentLocator(Locator locator)
mHandler.
setDocumentLocator in interface ContentHandlersetDocumentLocator in class DefaultHandlerlocator - A locator for all SAX document events.
SAXException - if the contained hanlder throws a SAX
exception.
public InputSource resolveEntity(String publicId,
String systemId)
throws SAXException
mHandler.
Note that this method only throws SAX exceptions, whereas the SAX specification allows it to also throw an I/O exception. In this class's implementation, all I/O exceptions thrown by the delegate are converted to SAX exceptions before being re-thrown by this method. This extreme measure is taken because a bug in JDK 1.4.x failed to delcare an I/O exception on the resolve entity method. Although Sun's 1.5 JDK does declare the exception, this method converts it to allow the same source to compile in 1.4 and 1.5. For more information on this bug, see Sun's bug report:
resolveEntity in DefaultHandler does not throw IOException
resolveEntity in interface EntityResolverresolveEntity in class DefaultHandlerpublicId - The public identifier, or null if
none is available.systemId - The system identifier provided in the XML
document.
SAXException - if the contained hanlder throws a SAX
exception.
public void error(SAXParseException exception)
throws SAXException
mHandler.
error in interface ErrorHandlererror in class DefaultHandlerexception - The error information, encoded as an exception.
SAXException - if the contained hanlder throws a SAX
exception.
public void fatalError(SAXParseException exception)
throws SAXException
mHandler.
fatalError in interface ErrorHandlerfatalError in class DefaultHandlerexception - The fatal error information, encoded as an
exception.
SAXException - if the contained hanlder throws a SAX
exception.
public void warning(SAXParseException exception)
throws SAXException
mHandler.
warning in interface ErrorHandlerwarning in class DefaultHandlerexception - The warning information, encoded as an exception.
SAXException - if the contained hanlder throws a SAX
exception.
public void notationDecl(String name,
String publicId,
String systemId)
throws SAXException
mHandler.
notationDecl in interface DTDHandlernotationDecl in class DefaultHandlername - The notation name.publicId - The notation public identifier, or
null if none is available.systemId - The notation system identifier.
SAXException - if the contained hanlder throws a SAX
exception.
public void unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
throws SAXException
mHandler.
unparsedEntityDecl in interface DTDHandlerunparsedEntityDecl in class DefaultHandlername - The entity name.publicId - The entity public identifier, or
null if none is available.systemId - The entity system identifier.notationName - The name of the associated notation.
SAXException - if the contained hanlder throws a SAX
exception.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||