net.sf.joost.trax
Class TransformerHandlerImpl

java.lang.Object
  extended by net.sf.joost.trax.TransformerHandlerImpl
All Implemented Interfaces:
TransformerHandler, Constants, ContentHandler, DTDHandler, LexicalHandler

public class TransformerHandlerImpl
extends Object
implements TransformerHandler, Constants

This class implements the TransformerHandler-Interface for TraX. This class could be used with a SAXResult. So you can simply downcast the TransformerFactory to a SAXTransformerFactory, calling getTransformerHandler() and process the transformation with a Sax-Parser. TransformerHandler acts as a proxy an propagates the Sax-Events to the underlying joost-stx-engine the Processor-class

Author:
Zubow

Field Summary
private static org.apache.commons.logging.Log log
           
private  Processor processor
          Processor is the joost-stx-engine
private  Result result
          The according Result.
private  StxEmitter stxEmitter
          Handler for constructing the Resulttype.
private  String systemId
          Necessary for the document root.
private  Transformer transformer
           
 
Fields inherited from interface net.sf.joost.Constants
DEBUG, DEFAULT_ENCODING, FEAT_NS, FEAT_NSPREFIX, FEATURE_URI_PREFIX, FUNC_NS, JOOST_EXT_NS, PR_ATTRIBUTES, PR_BUFFER, PR_CHILDREN, PR_CONTINUE, PR_ERROR, PR_SELF, PR_SIBLINGS, STX_NS
 
Constructor Summary
protected TransformerHandlerImpl(Transformer transformer)
          Constructor.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Propagates the Sax-Event to Joost-Processor.
 void comment(char[] ch, int start, int length)
          Propagates the Sax-Event to Joost-Processor.
 void endCDATA()
          Propagates the Sax-Event to Joost-Processor.
 void endDocument()
          Propagates the Sax-Event to Joost-Processor.
 void endDTD()
          Propagates the Sax-Event to Joost-Processor.
 void endElement(String namespaceURI, String localName, String qName)
          Propagates the Sax-Event to Joost-Processor.
 void endEntity(String name)
          Propagates the Sax-Event to Joost-Processor.
 void endPrefixMapping(String prefix)
          Propagates the Sax-Event to Joost-Processor.
 String getSystemId()
          Getter for systemId
 Transformer getTransformer()
          Gets a Transformer object.
 void ignorableWhitespace(char[] ch, int start, int length)
          Propagates the Sax-Event to Joost-Processor.
private  void init(Result result)
          Helpermethod
 void notationDecl(String name, String publicId, String systemId)
          Sax-Event - empty
 void processingInstruction(String target, String data)
          Propagates the Sax-Event to Joost-Processor.
 void setDocumentLocator(Locator locator)
          Propagates the Sax-Event to Joost-Processor.
 void setResult(Result result)
          Setter for result
 void setSystemId(String systemId)
          Setter for systemId
 void skippedEntity(String name)
          Propagates the Sax-Event to Joost-Processor.
 void startCDATA()
          Propagates the Sax-Event to Joost-Processor.
 void startDocument()
          Propagates the Sax-Event to Joost-Processor.
 void startDTD(String name, String publicId, String systemId)
          Propagates the Sax-Event to Joost-Processor.
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          Propagates the Sax-Event to Joost-Processor.
 void startEntity(String name)
          Propagates the Sax-Event to Joost-Processor.
 void startPrefixMapping(String prefix, String uri)
          Propagates the Sax-Event to Joost-Processor.
 void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
          Sax-Event - empty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

processor

private Processor processor
Processor is the joost-stx-engine


transformer

private Transformer transformer

stxEmitter

private StxEmitter stxEmitter
Handler for constructing the Resulttype.


systemId

private String systemId
Necessary for the document root.


result

private Result result
The according Result.

Constructor Detail

TransformerHandlerImpl

protected TransformerHandlerImpl(Transformer transformer)
Constructor.

Parameters:
transformer -
Method Detail

getSystemId

public String getSystemId()
Getter for systemId

Specified by:
getSystemId in interface TransformerHandler
Returns:
String

getTransformer

public Transformer getTransformer()
Gets a Transformer object.

Specified by:
getTransformer in interface TransformerHandler
Returns:
String

setResult

public void setResult(Result result)
               throws IllegalArgumentException
Setter for result

Specified by:
setResult in interface TransformerHandler
Parameters:
result - A Result
Throws:
IllegalArgumentException

setSystemId

public void setSystemId(String systemId)
Setter for systemId

Specified by:
setSystemId in interface TransformerHandler
Parameters:
systemId - the system identifier to set

init

private void init(Result result)
           throws TransformerException
Helpermethod

Throws:
TransformerException

setDocumentLocator

public void setDocumentLocator(Locator locator)
Propagates the Sax-Event to Joost-Processor.

Specified by:
setDocumentLocator in interface ContentHandler

startDocument

public void startDocument()
                   throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
endPrefixMapping in interface ContentHandler
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
startElement in interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
endElement in interface ContentHandler
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
characters in interface ContentHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
startDTD in interface LexicalHandler
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
endDTD in interface LexicalHandler
Throws:
SAXException

startEntity

public void startEntity(String name)
                 throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
startEntity in interface LexicalHandler
Throws:
SAXException

endEntity

public void endEntity(String name)
               throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
endEntity in interface LexicalHandler
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
startCDATA in interface LexicalHandler
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
endCDATA in interface LexicalHandler
Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Propagates the Sax-Event to Joost-Processor.

Specified by:
comment in interface LexicalHandler
Throws:
SAXException

notationDecl

public void notationDecl(String name,
                         String publicId,
                         String systemId)
                  throws SAXException
Sax-Event - empty

Specified by:
notationDecl in interface DTDHandler
Throws:
SAXException

unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               String publicId,
                               String systemId,
                               String notationName)
                        throws SAXException
Sax-Event - empty

Specified by:
unparsedEntityDecl in interface DTDHandler
Throws:
SAXException