gnu.xml.pipeline
public final class TeeConsumer extends Object implements EventConsumer, ContentHandler, DTDHandler, LexicalHandler, DeclHandler
Error handling should be simple if you remember that exceptions you throw will cancel later stages in that callback's pipeline, and generally the producer will stop if it sees such an exception. You may want to protect your pipeline against such backflows, making a kind of reverse filter (or valve?) so that certain exceptions thrown by your pipeline will caught and handled before the producer sees them. Just use a "try/catch" block, rememebering that really important cleanup tasks should be in "finally" clauses.
That issue isn't unique to "tee" consumers, but tee consumers have the additional twist that exceptions thrown by the first consumer will cause the second consumer not to see the callback (except for the endDocument callback, which signals state cleanup).
Version: $Date: 2001/10/24 22:50:33 $
Constructor Summary | |
---|---|
TeeConsumer(EventConsumer car, EventConsumer cdr)
Constructs a consumer which sends all its events to the first
consumer, and then the second one. |
Method Summary | |
---|---|
void | attributeDecl(String eName, String aName, String type, String mode, String value) |
void | characters(char[] ch, int start, int length) |
void | comment(char[] ch, int start, int length) |
void | elementDecl(String name, String model) |
void | endCDATA() |
void | endDocument() |
void | endDTD() |
void | endElement(String uri, String localName, String qName) |
void | endEntity(String name) |
void | endPrefixMapping(String prefix) |
void | externalEntityDecl(String name, String publicId, String systemId) |
ContentHandler | getContentHandler() Returns the content handler being used. |
DTDHandler | getDTDHandler() Returns the dtd handler being used. |
EventConsumer | getFirst() Returns the first pipeline to get event calls. |
Object | getProperty(String id) Returns the declaration or lexical handler being used. |
EventConsumer | getRest() Returns the second pipeline to get event calls. |
void | ignorableWhitespace(char[] ch, int start, int length) |
void | internalEntityDecl(String name, String value) |
void | notationDecl(String name, String publicId, String systemId) |
void | processingInstruction(String target, String data) |
void | setDocumentLocator(Locator locator) |
void | setErrorHandler(ErrorHandler handler)
Provides the error handler to both subsequent nodes of
this filter stage. |
void | skippedEntity(String name) |
void | startCDATA() |
void | startDocument() |
void | startDTD(String name, String publicId, String systemId) |
void | startElement(String uri, String localName, String qName, Attributes atts) |
void | startEntity(String name) |
void | startPrefixMapping(String prefix, String uri) |
void | unparsedEntityDecl(String name, String publicId, String systemId, String notationName) |
Parameters: car The first consumer to get the events cdr The second consumer to get the events
Source code is under GPL (with library exception) in the JAXP project at http://www.gnu.org/software/classpathx/jaxp
This documentation was derived from that source code on 2011-08-26.