public class ContentHandlerDecorator extends DefaultHandler
ContentHandler
interface. This class
simply delegates all SAX events calls to an underlying decorated handler
instance. Subclasses can provide extra decoration by overriding one or more
of the SAX event methods.Modifier | Constructor and Description |
---|---|
protected |
ContentHandlerDecorator()
Creates a decorator that by default forwards incoming SAX events to
a dummy content handler that simply ignores all the events.
|
|
ContentHandlerDecorator(ContentHandler handler)
Creates a decorator for the given SAX event handler.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
endDocument() |
void |
endElement(String uri,
String localName,
String name) |
void |
endPrefixMapping(String prefix) |
protected void |
handleException(SAXException exception)
Handle any exceptions thrown by methods in this class.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
void |
processingInstruction(String target,
String data) |
protected void |
setContentHandler(ContentHandler handler)
Sets the underlying content handler.
|
void |
setDocumentLocator(Locator locator) |
void |
skippedEntity(String name) |
void |
startDocument() |
void |
startElement(String uri,
String localName,
String name,
Attributes atts) |
void |
startPrefixMapping(String prefix,
String uri) |
String |
toString() |
error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
public ContentHandlerDecorator(ContentHandler handler)
handler
- SAX event handler to be decoratedprotected ContentHandlerDecorator()
setContentHandler(ContentHandler)
method to
switch to a more usable underlying content handler.protected void setContentHandler(ContentHandler handler)
handler
- content handlerpublic void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class DefaultHandler
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class DefaultHandler
SAXException
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
processingInstruction
in class DefaultHandler
SAXException
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DefaultHandler
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class DefaultHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class DefaultHandler
SAXException
public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
public void endElement(String uri, String localName, String name) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class DefaultHandler
SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
ignorableWhitespace
in class DefaultHandler
SAXException
public void skippedEntity(String name) throws SAXException
skippedEntity
in interface ContentHandler
skippedEntity
in class DefaultHandler
SAXException
protected void handleException(SAXException exception) throws SAXException
exception
- the exception that was thrownSAXException
- the exception (if any) thrown to the clientCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.