Fans its events out to two other consumers, a "tee" filter stage in an
event pipeline. Networks can be assembled with multiple output points.
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).
void | attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String mode, java.lang.String value)
|
void | characters(char ch[][] , int start, int length)
|
void | comment(char ch[][] , int start, int length)
|
void | elementDecl(java.lang.String name, java.lang.String model)
|
void | endCDATA()
|
void | endDTD()
|
void | endDocument()
|
void | endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
|
void | endEntity(java.lang.String name)
|
void | endPrefixMapping(java.lang.String prefix)
|
void | externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
|
org.xml.sax.ContentHandler | getContentHandler()
|
org.xml.sax.DTDHandler | getDTDHandler()
|
gnu.xml.pipeline.EventConsumer | getFirst()
|
java.lang.Object | getProperty(java.lang.String id)
|
gnu.xml.pipeline.EventConsumer | getRest()
|
void | ignorableWhitespace(char ch[][] , int start, int length)
|
void | internalEntityDecl(java.lang.String name, java.lang.String value)
|
void | notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
|
void | processingInstruction(java.lang.String target, java.lang.String data)
|
void | setDocumentLocator(org.xml.sax.Locator locator)
|
void | setErrorHandler(org.xml.sax.ErrorHandler handler)
|
void | skippedEntity(java.lang.String name)
|
void | startCDATA()
|
void | startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
|
void | startDocument()
|
void | startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
|
void | startEntity(java.lang.String name)
|
void | startPrefixMapping(java.lang.String prefix, java.lang.String uri)
|
void | unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
|
Constructs a consumer which sends all its events to the first
consumer, and then the second one. If the first consumer throws
an exception, the second one will not see the event which
caused that exception to be reported.
Returns the content handler being used.
Returns the dtd handler being used.
Returns the first pipeline to get event calls.
Returns the declaration or lexical handler being used.
Returns the second pipeline to get event calls.
Provides the error handler to both subsequent nodes of
this filter stage.
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).