Class TraXLiaison
java.lang.Object
org.apache.tools.ant.taskdefs.optional.TraXLiaison
- All Implemented Interfaces:
javax.xml.transform.ErrorListener
,XSLTLiaison
,XSLTLiaison2
,XSLTLiaison3
,XSLTLiaison4
,XSLTLoggerAware
public class TraXLiaison extends java.lang.Object implements XSLTLiaison4, javax.xml.transform.ErrorListener, XSLTLoggerAware
Concrete liaison for XSLT processor implementing TraX. (ie JAXP 1.1)
- Since:
- Ant 1.3
-
Field Summary
-
Constructor Summary
Constructors Constructor Description TraXLiaison()
Constructor for TraXLiaison. -
Method Summary
Modifier and Type Method Description void
addParam(java.lang.String name, java.lang.Object value)
Add a parameter.void
addParam(java.lang.String name, java.lang.String value)
Add a parameter.void
configure(XSLTProcess xsltTask)
Specific configuration for the TRaX liaison.void
error(javax.xml.transform.TransformerException e)
Log an error.void
fatalError(javax.xml.transform.TransformerException e)
Log a fatal error.protected java.lang.String
getSystemId(java.io.File file)
Deprecated.since 1.5.x.void
setAttribute(java.lang.String name, java.lang.Object value)
Set a custom attribute for the JAXP factory implementation.void
setEntityResolver(org.xml.sax.EntityResolver aResolver)
Set the class to resolve entities during the transformation.void
setFactory(java.lang.String name)
Set the factory name to use instead of JAXP default lookup.void
setFeature(java.lang.String name, boolean value)
Set a custom feature for the JAXP factory implementation.void
setLogger(XSLTLogger l)
Set a logger.void
setOutputProperty(java.lang.String name, java.lang.String value)
Set the output property for the current transformer.void
setStylesheet(java.io.File stylesheet)
Set the stylesheet file.void
setStylesheet(Resource stylesheet)
Set the stylesheet file.void
setURIResolver(javax.xml.transform.URIResolver aResolver)
Set the class to resolve URIs during the transformationvoid
transform(java.io.File infile, java.io.File outfile)
Transform an input file.void
warning(javax.xml.transform.TransformerException e)
Log a warning.
-
Constructor Details
-
TraXLiaison
public TraXLiaison() throws java.lang.ExceptionConstructor for TraXLiaison.- Throws:
java.lang.Exception
- never
-
-
Method Details
-
setStylesheet
public void setStylesheet(java.io.File stylesheet) throws java.lang.ExceptionSet the stylesheet file.- Specified by:
setStylesheet
in interfaceXSLTLiaison
- Parameters:
stylesheet
- aFile
value- Throws:
java.lang.Exception
- on error
-
setStylesheet
Set the stylesheet file.- Specified by:
setStylesheet
in interfaceXSLTLiaison3
- Parameters:
stylesheet
- aResource
value- Throws:
java.lang.Exception
- on error
-
transform
public void transform(java.io.File infile, java.io.File outfile) throws java.lang.ExceptionTransform an input file.- Specified by:
transform
in interfaceXSLTLiaison
- Parameters:
infile
- the file to transformoutfile
- the result file- Throws:
java.lang.Exception
- on error- See Also:
XSLTLiaison.setStylesheet(File)
-
setFactory
public void setFactory(java.lang.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(java.lang.String name, java.lang.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(java.lang.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(java.lang.String name, java.lang.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(org.xml.sax.EntityResolver aResolver)Set the class to resolve entities during the transformation.- Parameters:
aResolver
- the resolver class.
-
setURIResolver
public void setURIResolver(javax.xml.transform.URIResolver aResolver)Set the class to resolve URIs during the transformation- Parameters:
aResolver
- aEntityResolver
value
-
addParam
public void addParam(java.lang.String name, java.lang.String value)Add a parameter.- Specified by:
addParam
in interfaceXSLTLiaison
- Parameters:
name
- the name of the parametervalue
- the value of the parameter- See Also:
XSLTLiaison4.addParam(java.lang.String, java.lang.Object)
-
addParam
public void addParam(java.lang.String name, java.lang.Object value)Add a parameter.- Specified by:
addParam
in interfaceXSLTLiaison4
- Parameters:
name
- the name of the parametervalue
- the value of the parameter- Since:
- Ant 1.9.3
- See Also:
Transformer.setParameter(java.lang.String, java.lang.Object)
-
setLogger
Set a logger.- Specified by:
setLogger
in interfaceXSLTLoggerAware
- Parameters:
l
- a logger.
-
error
public void error(javax.xml.transform.TransformerException e)Log an error.- Specified by:
error
in interfacejavax.xml.transform.ErrorListener
- Parameters:
e
- the exception to log.
-
fatalError
public void fatalError(javax.xml.transform.TransformerException e)Log a fatal error.- Specified by:
fatalError
in interfacejavax.xml.transform.ErrorListener
- Parameters:
e
- the exception to log.
-
warning
public void warning(javax.xml.transform.TransformerException e)Log a warning.- Specified by:
warning
in interfacejavax.xml.transform.ErrorListener
- Parameters:
e
- the exception to log.
-
getSystemId
@Deprecated protected java.lang.String getSystemId(java.io.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
Specific configuration for the TRaX liaison.- Specified by:
configure
in interfaceXSLTLiaison2
- Parameters:
xsltTask
- the XSLTProcess task instance from which this liaison is to be configured.
-