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.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate 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 stylesheetprivate
Transform
(Input.Builder input, Input.Builder stylesheet) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear parameters used for the transformationprivate String
getParameter
(String name) See a parameter used for the transformationPerform the XSLT transformation specified in the constructorPerform the XSLT transformation specified in the constructorprivate void
provideSystemIdIfRequired
(Source source) Ensure that the source has a systemIdvoid
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(package private) static <R> R
withExceptionHandling
(Transform.Trans<R> trans)
-
Field Details
-
PWD
-
transformation
-
parameters
-
-
Constructor Details
-
Transform
Create a transformation using String input XML and String stylesheet- Parameters:
input
-stylesheet
-
-
Transform
Create a transformation using String input XML and stylesheet in a File- Parameters:
input
-stylesheet
-
-
Transform
Create a transformation using InputSource input XML and InputSource stylesheet- Parameters:
input
-stylesheet
-
-
Transform
Create a transformation using InputSource input XML and stylesheet in a File- Parameters:
input
-stylesheet
-
-
Transform
Create a transformation that allows us to serialize a DOM Node- Parameters:
sourceNode
-
-
Transform
Create a transformation from an input Node and stylesheet in a String- Parameters:
sourceNode
-stylesheet
-
-
Transform
Create a transformation from an input Node and stylesheet in a File- Parameters:
sourceNode
-stylesheet
-
-
Transform
-
Transform
Create a transformation using Source input XML and Source stylesheet- Parameters:
inputSource
-stylesheetSource
-
-
-
Method Details
-
provideSystemIdIfRequired
Ensure that the source has a systemId- Parameters:
source
-
-
getDefaultSystemId
- Returns:
- the current working directory as an URL-form string
-
transformTo
Perform the actual transformation- Parameters:
result
-- Throws:
TransformerException
-
getResultString
Perform the XSLT transformation specified in the constructor- Returns:
- the result as a String
- Throws:
TransformerException
-
getResultDocument
Perform the XSLT transformation specified in the constructor- Returns:
- the result as a DOM Document
- Throws:
TransformerException
-
setOutputProperty
Override an output property specified in the transformation stylesheet- Parameters:
name
-value
-
-
setOutputProperties
Override output properties specified in the transformation stylesheet- Parameters:
outputProperties
-- See Also:
-
setParameter
Add a parameter for the transformation- Parameters:
name
-value
-- See Also:
-
getParameter
See a parameter used for the transformation- Parameters:
name
-- 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- See Also:
-
setErrorListener
Set the ErrorListener for the transformation- See Also:
-
withExceptionHandling
- Throws:
TransformerException
-