net.sf.saxon

Class TransformerHandlerImpl

Implemented Interfaces:
ContentHandler, DTDHandler, LexicalHandler, TransformerHandler

public class TransformerHandlerImpl
extends ReceivingContentHandler
implements TransformerHandler

TransformerHandlerImpl implements the javax.xml.transform.sax.TransformerHandler interface. It acts as a ContentHandler and LexicalHandler which receives a stream of SAX events representing an input document, and performs a transformation treating this SAX stream as the source document of the transformation.
Author:
Michael H. Kay

Constructor Summary

TransformerHandlerImpl(Controller controller)
Create a TransformerHandlerImpl and initialise variables.

Method Summary

void
endDocument()
Override the behaviour of endDocument() in ReceivingContentHandler, so that it fires off the transformation of the constructed document
Result
getResult()
Get the output destination of the transformation
String
getSystemId()
Get the systemId of the document.
Transformer
getTransformer()
Get the Transformer used for this transformation
void
setResult(Result result)
Set the output destination of the transformation
void
setSystemId(String url)
Set the SystemId of the document.
void
startDocument()
Start of a new document.

Methods inherited from class net.sf.saxon.event.ReceivingContentHandler

characters, comment, endCDATA, endDTD, endDocument, endElement, endEntity, endPrefixMapping, getConfiguration, getPipelineConfiguration, ignorableWhitespace, isIgnoringIgnorableWhitespace, notationDecl, processingInstruction, reset, setDocumentLocator, setIgnoreIgnorableWhitespace, setPipelineConfiguration, setReceiver, skippedEntity, startCDATA, startDTD, startDocument, startElement, startEntity, startPrefixMapping, unparsedEntityDecl

Constructor Details

TransformerHandlerImpl

protected TransformerHandlerImpl(Controller controller)
Create a TransformerHandlerImpl and initialise variables. The constructor is protected, because the Filter should be created using newTransformerHandler() in the SAXTransformerFactory class
Parameters:
controller - the Controller to be used

Method Details

endDocument

public void endDocument()
            throws SAXException
Override the behaviour of endDocument() in ReceivingContentHandler, so that it fires off the transformation of the constructed document
Overrides:
endDocument in interface ReceivingContentHandler

getResult

public Result getResult()
Get the output destination of the transformation
Returns:
the output destination

getSystemId

public String getSystemId()

getTransformer

public Transformer getTransformer()
Get the Transformer used for this transformation

setResult

public void setResult(Result result)
Set the output destination of the transformation

setSystemId

public void setSystemId(String url)
Set the SystemId of the document. Note that in reporting location information, Saxon gives priority to the system Id reported by the SAX Parser in the Locator passed to the setDocumentLocator(org.xml.sax.Locator) method. The SystemId passed to this method is used as the base URI for resolving relative references.
Parameters:
url - the systemId of the source document

startDocument

public void startDocument()
            throws SAXException
Start of a new document. The TransformerHandler is not serially reusable, so this method must only be called once.
Overrides:
startDocument in interface ReceivingContentHandler