Class TransformerImpl

java.lang.Object
javax.xml.transform.Transformer
org.exolab.adaptx.jaxp.transform.TransformerImpl

public class TransformerImpl extends Transformer
The implementation of javax.xml.transform.Transformer to allow Adaptx to be compatible with the JAXP 1.1 specification. For information on what this class is supposed to do, please read the JAXP 1.1 specification.
Version:
$Revision: 3945 $ $Date: 2003-10-03 23:01:25 +0200 (Fri, 03 Oct 2003) $
Author:
Keith Visco
  • Constructor Details

    • TransformerImpl

      public TransformerImpl()
      Creates a new default TransformerImpl
    • TransformerImpl

      public TransformerImpl(XSLTStylesheet stylesheet)
      Creates a new TransformerImpl for the given XSLTStylesheet.
      Parameters:
      stylesheet - the XSLTStylesheet to use for the transformation
  • Method Details

    • clearParameters

      public void clearParameters()
      Clear all parameters set with setParameter.
      Specified by:
      clearParameters in class Transformer
    • getErrorListener

      public ErrorListener getErrorListener()
      Get the error event handler in effect for the transformation.
      Specified by:
      getErrorListener in class Transformer
      Returns:
      The current error handler, which should never be null.
    • getParameter

      public Object getParameter(String name)
      Returns the parameter with the given name, that was previously set with the setParameter or setParameters methods.

      Javadoc included from JAXP 1.1 Transfomer:

      This method does not return a default parameter value, which cannot be determined until the node context is evaluated during the transformation process.

      Specified by:
      getParameter in class Transformer
      Returns:
      A parameter that has been set with setParameter or setParameters.
    • getURIResolver

      public URIResolver getURIResolver()
      Returns the URIResolver that will used during processing for resolving URIs. This will be the URIResolver that was previously set with a call to the setURIResolver method, or null if no such call was made.
      Specified by:
      getURIResolver in class Transformer
      Returns:
      the previously set URIResolver, or null if no URIResolver has been set.
    • getResultHandler

      public static final ResultHandler getResultHandler(Result result) throws TransformerException
      Returns an Adaptx ResultHandler for the given JAXP Result
      Returns:
      the Adaptx ResultHandler for the given JAXP Result
      Throws:
      TransformerException - if the given Result is not supported, or if any exceptions occur while attempting to create a ResultHandler.
    • getProcessor

      public XSLTProcessor getProcessor()
      Returns the underlying XSLTProcessor instance for this Transformer
      Returns:
      the XSLTProcessor instance
    • setErrorListener

      public void setErrorListener(ErrorListener listener) throws IllegalArgumentException
      Set the error event listener in effect for the transformation.
      Specified by:
      setErrorListener in class Transformer
      Parameters:
      listener - The new error listener.
      Throws:
      IllegalArgumentException - if listener is null.
    • setParameter

      public void setParameter(String name, Object value)
      Adds the given parameter (name/value binding) for the transformation.

      Javadoc included from JAXP 1.1 Transfomer:

      Pass a qualified name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.

      For example, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the TrAX name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.

      Specified by:
      setParameter in class Transformer
      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.
    • setURIResolver

      public void setURIResolver(URIResolver resolver)
      Set an object that will be used to resolve URIs encountered during processing.
      Specified by:
      setURIResolver in class Transformer
      Parameters:
      resolver - An object that implements the URIResolver interface, or null.
    • transform

      public void transform(Source xmlSource, Result outputTarget) throws TransformerException
      Process the given source tree to the output result.
      Specified by:
      transform in class Transformer
      Parameters:
      xmlSource - The input for the source tree.
      outputTarget - The output target.
      Throws:
      TransformerException - If an unrecoverable error occurs during the course of the transformation.
    • setOutputProperties

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

      Javadoc included from JAXP 1.1 Transfomer:

      If argument to this function is null, any properties previously set are removed.

      Pass a qualified property key name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.

      For example, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the TrAX name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.

      If a given property is not supported, it will be silently ignored.

      Specified by:
      setOutputProperties in class Transformer
      Parameters:
      properties - A set of output properties that will be used to override any of the same properties in effect for the transformation.
      Throws:
      IllegalArgumentException - if any of the argument keys are not recognized and are not namespace qualified.
      See Also:
    • getOutputProperties

      public Properties getOutputProperties()
      Get a copy of the output properties for the transformation.

      Javadoc included from JAXP 1.1 Transfomer:

      The properties should contain a set of layered properties. The first "layer" will contain the properties that were set with setOutputProperties and setOutputProperty. Subsequent layers contain the properties set in the stylesheet and the default properties for the transformation type. There is no guarantee on how the layers are ordered after the first layer. Thus, getOutputProperties().getProperty(String key) will obtain any property in effect for the stylesheet, while getOutputProperties().get(String key) will only retrieve properties that were explicitly set with setOutputProperties and setOutputProperty.

      Note that mutation of the Properties object returned will not effect the properties that the transformation contains.

      Specified by:
      getOutputProperties in class Transformer
      See Also:
    • setOutputProperty

      public void setOutputProperty(String name, String value) throws IllegalArgumentException

      Javadoc included from JAXP 1.1 Transfomer:

      Set an output property that will be in effect for the transformation.

      Pass a qualified property name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.

      For example, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the TrAX name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.

      Specified by:
      setOutputProperty in class Transformer
      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:
    • getOutputProperty

      public String getOutputProperty(String name) throws IllegalArgumentException

      Javadoc included from JAXP 1.1 Transfomer:

      Get an output property that is in effect for the transformation. The property specified may be a property that was set with setOutputProperty, or it may be a property specified in the stylesheet.
      Specified by:
      getOutputProperty in class Transformer
      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.
      Throws:
      IllegalArgumentException - If the property is not supported.
      See Also: