com.jclark.xsl.sax2
Class XSLProcessorImpl

java.lang.Object
  extended by com.jclark.xsl.sax2.XSLProcessorImpl
All Implemented Interfaces:
XSLProcessor, ParameterSet, java.lang.Cloneable, org.xml.sax.XMLReader

public class XSLProcessorImpl
extends java.lang.Object
implements XSLProcessor, java.lang.Cloneable, ParameterSet

An XSLT Processor


Constructor Summary
XSLProcessorImpl()
           
XSLProcessorImpl(Sheet sheet, Engine engine)
           
 
Method Summary
 void clearParameters()
           
 java.lang.Object clone()
          clone after loadStylesheet() enables us to re-use a transformer, without recompiling the stylesheet
 void configureResult()
           
 org.xml.sax.ContentHandler getContentHandler()
          SAX 2 XMLReader API.
 org.xml.sax.DTDHandler getDTDHandler()
          SAX XMLReader API
 org.xml.sax.EntityResolver getEntityResolver()
          SAX XMLReader API
 org.xml.sax.ErrorHandler getErrorHandler()
          SAX API
 boolean getFeature(java.lang.String featureURI)
          SAX API
 java.lang.Object getParameter(Name name)
           
 java.lang.Object getParameter(java.lang.String name)
          recognizes names in the form "{namespace-part}local-part" as used in TrAX
 java.lang.Object getProperty(java.lang.String name)
          SAX API
 org.xml.sax.ContentHandler getSourceBuilder()
           
 SAXTwoOMBuilder getSourceOMBuilder(java.lang.String systemId)
           
(package private)  void handleXSLException(XSLException e)
          rethrows an XSLException as a SAXException
 void loadStylesheet(org.xml.sax.InputSource sheetSource)
          load (and compile) the stylesheet
 void parse(org.xml.sax.InputSource source)
          load the input document into a (xslt) object model, and run the transform
 void parse(java.lang.String sourceURI)
          SAX XMLReader API
(package private)  void phase(int n)
           
 void setContentHandler(org.xml.sax.ContentHandler handler)
          SAX 2 XMLReader API.
 void setDebugger(java.lang.String name, ActionDebugTarget debugger)
          sets an extension element processor for XRAP
 void setDTDHandler(org.xml.sax.DTDHandler handler)
          SAX XMLReader API
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
          SAX XMLReader API
 void setErrorHandler(org.xml.sax.ErrorHandler handler)
          SAX API
 void setFeature(java.lang.String featureURI, boolean value)
          SAX API
 void setOutputMethodHandler(OutputMethodHandler handler)
          we can have either an OutputMethodHandler, or a DocumentHandler, not both
 void setParameter(java.lang.String name, java.lang.Object obj)
          recognizes names in the form "{namespace-part}local-part" as used in TrAX
 void setProperty(java.lang.String name, java.lang.Object value)
          SAX API
 void setReaders(org.xml.sax.XMLReader sourceReader, org.xml.sax.XMLReader sheetReader)
          set two XMLReaders (may be the same XMLReader), #1 for parsing the XML source to transform, #2 for parsing the stylesheeet.
 void setSaxExtensionFilter(java.lang.String name, SaxFilterMaker xrap)
          sets an extension element processor for XRAP
 void setSourceReader(org.xml.sax.XMLReader sourceReader)
          prepare for parsing the input XML document
 void transform(Node sourceRoot)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSLProcessorImpl

public XSLProcessorImpl()

XSLProcessorImpl

public XSLProcessorImpl(Sheet sheet,
                        Engine engine)
Method Detail

setReaders

public void setReaders(org.xml.sax.XMLReader sourceReader,
                       org.xml.sax.XMLReader sheetReader)
set two XMLReaders (may be the same XMLReader), #1 for parsing the XML source to transform, #2 for parsing the stylesheeet.

Specified by:
setReaders in interface XSLProcessor

setSourceReader

public void setSourceReader(org.xml.sax.XMLReader sourceReader)
prepare for parsing the input XML document

Specified by:
setSourceReader in interface XSLProcessor

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler handler)
SAX XMLReader API

Specified by:
setDTDHandler in interface org.xml.sax.XMLReader

getDTDHandler

public org.xml.sax.DTDHandler getDTDHandler()
SAX XMLReader API

Specified by:
getDTDHandler in interface org.xml.sax.XMLReader

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
SAX XMLReader API

Specified by:
setEntityResolver in interface org.xml.sax.XMLReader

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
SAX XMLReader API

Specified by:
getEntityResolver in interface org.xml.sax.XMLReader

setOutputMethodHandler

public void setOutputMethodHandler(OutputMethodHandler handler)
we can have either an OutputMethodHandler, or a DocumentHandler, not both

Specified by:
setOutputMethodHandler in interface XSLProcessor

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
SAX 2 XMLReader API. .. return the content handler this is writing to

Specified by:
getContentHandler in interface org.xml.sax.XMLReader
Returns:
null in no ContentHandler was set

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler handler)
SAX 2 XMLReader API. we can have either an OutputMethodHandler, or a ContentHandler, not both

Specified by:
setContentHandler in interface XSLProcessor
Specified by:
setContentHandler in interface org.xml.sax.XMLReader

getSourceBuilder

public org.xml.sax.ContentHandler getSourceBuilder()

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler handler)
SAX API

Specified by:
setErrorHandler in interface org.xml.sax.XMLReader

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
SAX API

Specified by:
getErrorHandler in interface org.xml.sax.XMLReader
Returns:
the error handler if one has been set, else null.

setFeature

public void setFeature(java.lang.String featureURI,
                       boolean value)
                throws org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
SAX API

Specified by:
setFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getFeature

public boolean getFeature(java.lang.String featureURI)
                   throws org.xml.sax.SAXNotRecognizedException,
                          org.xml.sax.SAXNotSupportedException
SAX API

Specified by:
getFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws org.xml.sax.SAXNotRecognizedException,
                                    org.xml.sax.SAXNotSupportedException
SAX API

Specified by:
getProperty in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws org.xml.sax.SAXNotRecognizedException,
                        org.xml.sax.SAXNotSupportedException
SAX API

Specified by:
setProperty in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

loadStylesheet

public void loadStylesheet(org.xml.sax.InputSource sheetSource)
                    throws org.xml.sax.SAXException,
                           java.io.IOException
load (and compile) the stylesheet

Specified by:
loadStylesheet in interface XSLProcessor
Throws:
org.xml.sax.SAXException
java.io.IOException

setSaxExtensionFilter

public void setSaxExtensionFilter(java.lang.String name,
                                  SaxFilterMaker xrap)
sets an extension element processor for XRAP

Specified by:
setSaxExtensionFilter in interface XSLProcessor

setDebugger

public void setDebugger(java.lang.String name,
                        ActionDebugTarget debugger)
sets an extension element processor for XRAP

Specified by:
setDebugger in interface XSLProcessor

parse

public void parse(java.lang.String sourceURI)
           throws org.xml.sax.SAXException,
                  java.io.IOException
SAX XMLReader API

Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException
java.io.IOException

parse

public void parse(org.xml.sax.InputSource source)
           throws org.xml.sax.SAXException,
                  java.io.IOException
load the input document into a (xslt) object model, and run the transform

Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException
java.io.IOException

configureResult

public void configureResult()

transform

public void transform(Node sourceRoot)
               throws XSLException
Throws:
XSLException

getSourceOMBuilder

public SAXTwoOMBuilder getSourceOMBuilder(java.lang.String systemId)

handleXSLException

void handleXSLException(XSLException e)
                  throws org.xml.sax.SAXException,
                         java.io.IOException
rethrows an XSLException as a SAXException

Throws:
org.xml.sax.SAXException
java.io.IOException

phase

void phase(int n)

clone

public java.lang.Object clone()
Description copied from interface: XSLProcessor
clone after loadStylesheet() enables us to re-use a transformer, without recompiling the stylesheet

Specified by:
clone in interface XSLProcessor
Overrides:
clone in class java.lang.Object

getParameter

public java.lang.Object getParameter(Name name)
Specified by:
getParameter in interface ParameterSet

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object obj)
recognizes names in the form "{namespace-part}local-part" as used in TrAX

Specified by:
setParameter in interface XSLProcessor

getParameter

public java.lang.Object getParameter(java.lang.String name)
recognizes names in the form "{namespace-part}local-part" as used in TrAX


clearParameters

public void clearParameters()