TraXLiaison (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional, class: TraXLiaison

Package org.apache.tools.ant.taskdefs.optional

# Class TraXLiaison

java.lang.Object
org.apache.tools.ant.taskdefs.optional.TraXLiaison

All Implemented Interfaces:
  `ErrorListener`, `XSLTLiaison`, `XSLTLiaison2`, `XSLTLiaison3`, `XSLTLiaison4`, `XSLTLoggerAware`

public class TraXLiaison extends Object implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
Concrete liaison for XSLT processor implementing TraX. (ie JAXP 1.1)

Since:
  Ant 1.3

- ## Field Summary

  ### Fields inherited from interface org.apache.tools.ant.taskdefs.XSLTLiaison

  `FILE_PROTOCOL_PREFIX`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TraXLiaison()`
  Constructor for TraXLiaison.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addParam(String name, Object value)`
  Add a parameter.
  `void`
  `addParam(String name, String value)`
  Add a parameter.
  `void`
  `configure(XSLTProcess xsltTask)`
  Specific configuration for the TRaX liaison.
  `void`
  `error(TransformerException e)`
  Log an error.
  `void`
  `fatalError(TransformerException e)`
  Log a fatal error.
  `protected String`
  `getSystemId(File file)`
  Deprecated.
  since 1.5.x.
  `void`
  `setAttribute(String name, Object value)`
  Set a custom attribute for the JAXP factory implementation.
  `void`
  `setEntityResolver(EntityResolver aResolver)`
  Set the class to resolve entities during the transformation.
  `void`
  `setFactory(String name)`
  Set the factory name to use instead of JAXP default lookup.
  `void`
  `setFeature(String name, boolean value)`
  Set a custom feature for the JAXP factory implementation.
  `void`
  `setLogger(XSLTLogger l)`
  Set a logger.
  `void`
  `setOutputProperty(String name, String value)`
  Set the output property for the current transformer.
  `void`
  `setStylesheet(File stylesheet)`
  Set the stylesheet file.
  `void`
  `setStylesheet(Resource stylesheet)`
  Set the stylesheet file.
  `void`
  `setURIResolver(URIResolver aResolver)`
  Set the class to resolve URIs during the transformation
  `void`
  `transform(File infile, File outfile)`
  Transform an input file.
  `void`
  `warning(TransformerException e)`
  Log a warning.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TraXLiaison

    public TraXLiaison() throws Exception
    Constructor for TraXLiaison.
    Throws:
      `Exception` - never

- ## Method Details

  - ### setStylesheet

    public void setStylesheet(File stylesheet) throws Exception
    Set the stylesheet file.
    Specified by:
      `setStylesheet` in interface `XSLTLiaison`
    Parameters:
      `stylesheet` - a `File` value
    Throws:
      `Exception` - on error

  - ### setStylesheet

    public void setStylesheet(Resource stylesheet) throws Exception
    Set the stylesheet file.
    Specified by:
      `setStylesheet` in interface `XSLTLiaison3`
    Parameters:
      `stylesheet` - a `Resource` value
    Throws:
      `Exception` - on error

  - ### transform

    public void transform(File infile, File outfile) throws Exception
    Transform an input file.
    Specified by:
      `transform` in interface `XSLTLiaison`
    Parameters:
      `infile` - the file to transform
      `outfile` - the result file
    Throws:
      `Exception` - on error
    See Also:
      - `XSLTLiaison.setStylesheet(File)`

  - ### setFactory

    public void setFactory(String name)
    Set the factory name to use instead of JAXP default lookup.
    Parameters:
      `name` - the fully qualified class name of the factory to use or null for the default JAXP look up mechanism.
    Since:
      Ant 1.6

  - ### setAttribute

    public void setAttribute(String name, Object value)
    Set a custom attribute for the JAXP factory implementation.
    Parameters:
      `name` - the attribute name.
      `value` - the value of the attribute, usually a boolean string or object.
    Since:
      Ant 1.6

  - ### setFeature

    public void setFeature(String name, boolean value)
    Set a custom feature for the JAXP factory implementation.
    Parameters:
      `name` - the feature name.
      `value` - the value of the feature
    Since:
      Ant 1.9.8

  - ### setOutputProperty

    public void setOutputProperty(String name, String value)
    Set the output property for the current transformer. Note that the stylesheet must be set prior to calling this method.
    Parameters:
      `name` - the output property name.
      `value` - the output property value.
    Since:
      Ant 1.5, Ant 1.5

  - ### setEntityResolver

    public void setEntityResolver(EntityResolver aResolver)
    Set the class to resolve entities during the transformation.
    Parameters:
      `aResolver` - the resolver class.

  - ### setURIResolver

    public void setURIResolver(URIResolver aResolver)
    Set the class to resolve URIs during the transformation
    Parameters:
      `aResolver` - a `EntityResolver` value

  - ### addParam

    public void addParam(String name, String value)
    Add a parameter.
    Specified by:
      `addParam` in interface `XSLTLiaison`
    Parameters:
      `name` - the name of the parameter
      `value` - the value of the parameter
    See Also:
      - `XSLTLiaison4.addParam(java.lang.String, java.lang.Object)`

  - ### addParam

    public void addParam(String name, Object value)
    Add a parameter.
    Specified by:
      `addParam` in interface `XSLTLiaison4`
    Parameters:
      `name` - the name of the parameter
      `value` - the value of the parameter
    Since:
      Ant 1.9.3
    See Also:
      - `Transformer.setParameter(java.lang.String, java.lang.Object)`

  - ### setLogger

    public void setLogger(XSLTLogger l)
    Set a logger.
    Specified by:
      `setLogger` in interface `XSLTLoggerAware`
    Parameters:
      `l` - a logger.

  - ### error

    public void error(TransformerException e)
    Log an error.
    Specified by:
      `error` in interface `ErrorListener`
    Parameters:
      `e` - the exception to log.

  - ### fatalError

    public void fatalError(TransformerException e)
    Log a fatal error.
    Specified by:
      `fatalError` in interface `ErrorListener`
    Parameters:
      `e` - the exception to log.

  - ### warning

    public void warning(TransformerException e)
    Log a warning.
    Specified by:
      `warning` in interface `ErrorListener`
    Parameters:
      `e` - the exception to log.

  - ### getSystemId

    @Deprecated protected String getSystemId(File file)
    Deprecated.
    since 1.5.x. Use org.apache.tools.ant.util.JAXPUtils#getSystemId instead.
    Parameters:
      `file` - the filename to use for the systemid
    Returns:
      the systemid

  - ### configure

    public void configure(XSLTProcess xsltTask)
    Specific configuration for the TRaX liaison.
    Specified by:
      `configure` in interface `XSLTLiaison2`
    Parameters:
      `xsltTask` - the XSLTProcess task instance from which this liaison is to be configured.