org.apache.cocoon.transformation
Class ErrorAwareTraxTransformer

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.transformation.AbstractTransformer
                  extended byorg.apache.cocoon.transformation.TraxTransformer
                      extended byorg.apache.cocoon.transformation.ErrorAwareTraxTransformer
All Implemented Interfaces:
CacheableProcessingComponent, Configurable, ContentHandler, Disposable, ErrorListener, LexicalHandler, LogEnabled, Poolable, Recyclable, Serviceable, SitemapModelComponent, Transformer, XMLConsumer, XMLConsumer, XMLPipe, XMLProducer

public class ErrorAwareTraxTransformer
extends TraxTransformer
implements ErrorListener

An error aware TRAX-based transformer.

This might be a very stupid extension to the TraxTransformer, but in some very specific cases (for example when using Apache Xalan-J 2), the message output of the stylesheets, and error messages, can be greatly improved by just using this class instead of the default one.

Using this transformer with Apache Xalan-J 2, for example, will allow Cocoon to capture the output of <xsl:message&#nbsp;terminate="yes"/> and to serve it up using the standard error handling pipelines.

Author:
Pierpaolo Fumagalli

Field Summary
 
Fields inherited from class org.apache.cocoon.transformation.TraxTransformer
logicSheetParameters, manager, objectModel, transformerHandler, transformerValidity
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
ErrorAwareTraxTransformer()
           
 
Method Summary
 void error(TransformerException exception)
          Handle an error notification from the original TRAX transformer.
 void fatalError(TransformerException exception)
          Handle an error notification from the original TRAX transformer.
 void setConsumer(XMLConsumer consumer)
          Set the XMLConsumer that will receive XML data.
 void warning(TransformerException exception)
          Handle an error notification from the original TRAX transformer.
 
Methods inherited from class org.apache.cocoon.transformation.TraxTransformer
configure, dispose, endDocument, getKey, getLogicSheetParameters, getValidity, recycle, service, setup, startDocument
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startElement, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 

Constructor Detail

ErrorAwareTraxTransformer

public ErrorAwareTraxTransformer()
Method Detail

error

public void error(TransformerException exception)
           throws TransformerException

Handle an error notification from the original TRAX transformer.

This method simply throws the same exception passed in as a parameter.

Specified by:
error in interface ErrorListener
Throws:
TransformerException
See Also:
ErrorListener.error(TransformerException)

fatalError

public void fatalError(TransformerException exception)
                throws TransformerException

Handle an error notification from the original TRAX transformer.

This method simply throws the same exception passed in as a parameter.

Specified by:
fatalError in interface ErrorListener
Throws:
TransformerException
See Also:
ErrorListener.fatalError(TransformerException)

warning

public void warning(TransformerException exception)
             throws TransformerException

Handle an error notification from the original TRAX transformer.

This method simply throws the same exception passed in as a parameter.

Specified by:
warning in interface ErrorListener
Throws:
TransformerException
See Also:
ErrorListener.warning(TransformerException)

setConsumer

public void setConsumer(XMLConsumer consumer)
Set the XMLConsumer that will receive XML data.

Specified by:
setConsumer in interface XMLProducer
Overrides:
setConsumer in class TraxTransformer


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.