public final class Transformation extends Object
Apart from IllegalArgumentExceptions if you try to pass in null values only the transform methods will ever throw exceptions and these will be XMLUnit's runtime exceptions.
Each invocation of a transform method will use a fresh Transformer instance, the transform methods are thread-safe.
Constructor and Description |
---|
Transformation() |
Transformation(Source s) |
Modifier and Type | Method and Description |
---|---|
void |
addOutputProperty(String name,
String value)
Add a named output property.
|
void |
addParameter(String name,
Object value)
Add a named parameter.
|
void |
clearOutputProperties()
Clear all output properties.
|
void |
clearParameters()
Clear all output parameters.
|
void |
setErrorListener(ErrorListener l)
Set the error listener for the transformation.
|
void |
setFactory(TransformerFactory f)
Set the TraX factory to use.
|
void |
setSource(Source s)
Set the source document to transform.
|
void |
setStylesheet(Source s)
Set the stylesheet to use.
|
void |
setURIResolver(URIResolver r)
Set the resolver to use for document() and xsl:include/import
The resolver will not be attached to the factory.
|
void |
transformTo(Result r)
Perform the transformation.
|
Document |
transformToDocument()
Convenience method that returns the result of the
transformation as a Document.
|
String |
transformToString()
Convenience method that returns the result of the
transformation as a String.
|
public Transformation()
public Transformation(Source s)
s
- the source to transform - must not be null.public void setSource(Source s)
s
- the source to transform - must not be null.public void setStylesheet(Source s)
s
- the stylesheet to use - may be null in which case an
identity transformation will be performed.public void addOutputProperty(String name, String value)
name
- name of the property - must not be nullvalue
- value of the property - must not be nullpublic void clearOutputProperties()
public void addParameter(String name, Object value)
name
- name of the parameter - must not be nullvalue
- value of the parameter - may be nullpublic void clearParameters()
public void setFactory(TransformerFactory f)
f
- the factory to use - may be null in which case the
default factory will be used.public void setURIResolver(URIResolver r)
The resolver will not be attached to the factory.
r
- the resolver - may be null in which case no explicit
resolver will be usedpublic void setErrorListener(ErrorListener l)
The listener will not be attached to the factory.
l
- the listener - may be null in which case no listener
will be usedpublic void transformTo(Result r)
r
- where to send the transformation result - must not be nullIllegalStateException
- if source is nullIllegalArgumentException
- if result is nullConfigurationException
- if the TraX system isn't
configured properlyXMLUnitException
- if the transformation throws an
exceptionpublic String transformToString()
IllegalArgumentException
- if source is nullConfigurationException
- if the TraX system isn't
configured properlyXMLUnitException
- if the transformation throws an
exceptionpublic Document transformToDocument()
IllegalArgumentException
- if source is nullConfigurationException
- if the TraX system isn't
configured properlyXMLUnitException
- if the transformation throws an
exceptionCopyright © 2001–2017 XMLUnit. All rights reserved.