jd.xml.xslt.trax
Class TransformerImpl

java.lang.Object
  extended byjavax.xml.transform.Transformer
      extended byjd.xml.xslt.trax.TransformerImpl

public class TransformerImpl
extends Transformer

An implementation of the Trax Transformer class. Its functionality is equivalent to jd.xml.xslt.Transformation.


Constructor Summary
TransformerImpl(Transformation transformation)
          Create a TransformerImpl.
 
Method Summary
 void clearParameters()
          Clear all parameters set with setParameter.
 ErrorListener getErrorListener()
          Get the error event handler in effect for the transformation.
 Properties getOutputProperties()
          Return the output properties.
 String getOutputProperty(String name)
          Returns getOutputProperties().getProperty(name).
 Object getParameter(String name)
          Get a parameter that was explicitly set with setParameter or setParameters.
 Transformation getTransformation()
           
 URIResolver getURIResolver()
          Get an object that will be used to resolve URIs used in document(), etc.
 void setErrorListener(ErrorListener listener)
          Set the error event listener in effect for the transformation.
 void setOutputProperties(Properties outputProperties)
          Set the output properties for the transformation.
 void setOutputProperty(String name, String value)
          Set an output property that will be in effect for the transformation.
 void setParameter(String name, Object value)
          Add a parameter for the transformation.
 void setURIResolver(URIResolver resolver)
          Set an object that will be used to resolve URIs used in document().
 void transform(Source source, Result result)
          Process the source tree to the output result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformerImpl

public TransformerImpl(Transformation transformation)
Create a TransformerImpl.

Method Detail

getTransformation

public Transformation getTransformation()

transform

public void transform(Source source,
                      Result result)
               throws TransformerException
Process the source tree to the output result.

Parameters:
source - The input for the source tree.
result - The output target.
Throws:
TransformerException - If an unrecoverable error occurs during the course of the transformation.

clearParameters

public void clearParameters()
Clear all parameters set with setParameter.


setParameter

public void setParameter(String name,
                         Object value)
Add a parameter for the transformation.

Parameters:
name - The name of the parameter, which may begin with a namespace URI in curly braces ({}).
value - The value object. This can be any valid Java object. It is up to the processor to provide the proper object coersion or to simply pass the object on for use in an extension.

getParameter

public Object getParameter(String name)
Get a parameter that was explicitly set with setParameter or setParameters.

Returns:
A parameter that has been set with setParameter, or null if a parameter with the given name was not found.

getURIResolver

public URIResolver getURIResolver()
Get an object that will be used to resolve URIs used in document(), etc.

Returns:
An object that implements the URIResolver interface, or null.

setURIResolver

public void setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in document().

Parameters:
resolver - An object that implements the URIResolver interface, or null.

getOutputProperty

public String getOutputProperty(String name)
Returns getOutputProperties().getProperty(name). If called more than once its better to get the properties directly via getOutputProperties().

Parameters:
name - A non-null String that specifies an output property name, which may be namespace qualified.
Returns:
The string value of the output property, or null if no property was found.
See Also:
OutputKeys

getOutputProperties

public Properties getOutputProperties()
Return the output properties. In XSLT 1.1 the attributes of the xsl:output instruction are attribute value templates. If such a AVT is not constant then the returned Properties object will not contain a value for that option.

See Also:
OutputKeys, Properties

setOutputProperties

public void setOutputProperties(Properties outputProperties)
                         throws IllegalArgumentException
Set the output properties for the transformation. These properties will override properties set in the Templates with xsl:output.

Parameters:
outputProperties - A set of output properties that will be used to override any of the same properties in affect for the transformation.
Throws:
IllegalArgumentException - if any of the argument keys are not recognized and are not namespace qualified.
See Also:
OutputKeys, Properties

setOutputProperty

public void setOutputProperty(String name,
                              String value)
                       throws IllegalArgumentException
Set an output property that will be in effect for the transformation.

Parameters:
name - A non-null String that specifies an output property name, which may be namespace qualified.
value - The non-null string value of the output property.
Throws:
IllegalArgumentException - If the property is not supported, and is not qualified with a namespace.
See Also:
OutputKeys

setErrorListener

public void setErrorListener(ErrorListener listener)
                      throws IllegalArgumentException
Set the error event listener in effect for the transformation.

Parameters:
listener - The new error listener.
Throws:
IllegalArgumentException - if listener is null.

getErrorListener

public ErrorListener getErrorListener()
Get the error event handler in effect for the transformation.

Returns:
The current error handler, which should never be null.