Package org.custommonkey.xmlunit
Class Transform
java.lang.Object
org.custommonkey.xmlunit.Transform
Handy wrapper for an XSLT transformation performed using JAXP/Trax.
Note that transformation is not actually performed until a call to
getResultXXX
method, and Templates are not used.-
Constructor Summary
ConstructorDescriptionCreate a transformation using String input XML and stylesheet in a FileCreate a transformation using String input XML and String stylesheetCreate a transformation using Source input XML and Source stylesheetCreate a transformation that allows us to serialize a DOM NodeCreate a transformation from an input Node and stylesheet in a FileCreate a transformation from an input Node and stylesheet in a StringTransform
(InputSource input, File stylesheet) Create a transformation using InputSource input XML and stylesheet in a FileTransform
(InputSource input, InputSource stylesheet) Create a transformation using InputSource input XML and InputSource stylesheet -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear parameters used for the transformationgetParameter
(String name) See a parameter used for the transformationPerform the XSLT transformation specified in the constructorPerform the XSLT transformation specified in the constructorvoid
setErrorListener
(ErrorListener errorListener) Set the ErrorListener for the transformationvoid
setOutputProperties
(Properties outputProperties) Override output properties specified in the transformation stylesheetvoid
setOutputProperty
(String name, String value) Override an output property specified in the transformation stylesheetvoid
setParameter
(String name, Object value) Add a parameter for the transformationvoid
setURIResolver
(URIResolver uriResolver) Set the URIResolver for the transformationprotected void
transformTo
(Result result) Perform the actual transformation
-
Constructor Details
-
Transform
Create a transformation using String input XML and String stylesheet- Parameters:
input
- document to transformstylesheet
- stylesheet to use for transformation
-
Transform
Create a transformation using String input XML and stylesheet in a File- Parameters:
input
- document to transformstylesheet
- stylesheet to use for transformation
-
Transform
Create a transformation using InputSource input XML and InputSource stylesheet- Parameters:
input
- document to transformstylesheet
- stylesheet to use for transformation
-
Transform
Create a transformation using InputSource input XML and stylesheet in a File- Parameters:
input
- document to transformstylesheet
- stylesheet to use for transformation
-
Transform
Create a transformation that allows us to serialize a DOM Node- Parameters:
sourceNode
- document to transform
-
Transform
Create a transformation from an input Node and stylesheet in a String- Parameters:
sourceNode
- document to transformstylesheet
- stylesheet to use for transformation
-
Transform
Create a transformation from an input Node and stylesheet in a File- Parameters:
sourceNode
- document to transformstylesheet
- stylesheet to use for transformation
-
Transform
Create a transformation using Source input XML and Source stylesheet- Parameters:
inputSource
- document to transformstylesheetSource
- stylesheet to use for transformation
-
-
Method Details
-
transformTo
Perform the actual transformation- Parameters:
result
- result to output transformation result to- Throws:
TransformerException
- if transformation fails
-
getResultString
Perform the XSLT transformation specified in the constructor- Returns:
- the result as a String
- Throws:
TransformerException
- if transformation fails
-
getResultDocument
Perform the XSLT transformation specified in the constructor- Returns:
- the result as a DOM Document
- Throws:
TransformerException
- if transformation fails
-
setOutputProperty
Override an output property specified in the transformation stylesheet- Parameters:
name
- name of the propertyvalue
- value of the property
-
setOutputProperties
Override output properties specified in the transformation stylesheet- Parameters:
outputProperties
- output properties- See Also:
-
setParameter
Add a parameter for the transformation- Parameters:
name
- name of the parametervalue
- value of the parameter- See Also:
-
getParameter
See a parameter used for the transformation- Parameters:
name
- name of the parameter- Returns:
- the parameter value
- See Also:
-
clearParameters
public void clearParameters()Clear parameters used for the transformation- See Also:
-
setURIResolver
Set the URIResolver for the transformation- Parameters:
uriResolver
- resolver to use- See Also:
-
setErrorListener
Set the ErrorListener for the transformation- Parameters:
errorListener
- error listener to use- See Also:
-