Package org.custommonkey.xmlunit
Class Transform
- java.lang.Object
-
- org.custommonkey.xmlunit.Transform
-
public class Transform extends java.lang.ObjectHandy wrapper for an XSLT transformation performed using JAXP/Trax. Note that transformation is not actually performed until a call togetResultXXXmethod, and Templates are not used.
-
-
Constructor Summary
Constructors Constructor Description Transform(java.lang.String input, java.io.File stylesheet)Create a transformation using String input XML and stylesheet in a FileTransform(java.lang.String input, java.lang.String stylesheet)Create a transformation using String input XML and String stylesheetTransform(javax.xml.transform.Source inputSource, javax.xml.transform.Source stylesheetSource)Create a transformation using Source input XML and Source stylesheetTransform(org.w3c.dom.Node sourceNode)Create a transformation that allows us to serialize a DOM NodeTransform(org.w3c.dom.Node sourceNode, java.io.File stylesheet)Create a transformation from an input Node and stylesheet in a FileTransform(org.w3c.dom.Node sourceNode, java.lang.String stylesheet)Create a transformation from an input Node and stylesheet in a StringTransform(org.xml.sax.InputSource input, java.io.File stylesheet)Create a transformation using InputSource input XML and stylesheet in a FileTransform(org.xml.sax.InputSource input, org.xml.sax.InputSource stylesheet)Create a transformation using InputSource input XML and InputSource stylesheet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearParameters()Clear parameters used for the transformationjava.lang.ObjectgetParameter(java.lang.String name)See a parameter used for the transformationorg.w3c.dom.DocumentgetResultDocument()Perform the XSLT transformation specified in the constructorjava.lang.StringgetResultString()Perform the XSLT transformation specified in the constructorvoidsetErrorListener(javax.xml.transform.ErrorListener errorListener)Set the ErrorListener for the transformationvoidsetOutputProperties(java.util.Properties outputProperties)Override output properties specified in the transformation stylesheetvoidsetOutputProperty(java.lang.String name, java.lang.String value)Override an output property specified in the transformation stylesheetvoidsetParameter(java.lang.String name, java.lang.Object value)Add a parameter for the transformationvoidsetURIResolver(javax.xml.transform.URIResolver uriResolver)Set the URIResolver for the transformationprotected voidtransformTo(javax.xml.transform.Result result)Perform the actual transformation
-
-
-
Constructor Detail
-
Transform
public Transform(java.lang.String input, java.lang.String stylesheet)Create a transformation using String input XML and String stylesheet- Parameters:
input- document to transformstylesheet- stylesheet to use for transformation
-
Transform
public Transform(java.lang.String input, java.io.File stylesheet)Create a transformation using String input XML and stylesheet in a File- Parameters:
input- document to transformstylesheet- stylesheet to use for transformation
-
Transform
public Transform(org.xml.sax.InputSource input, org.xml.sax.InputSource stylesheet)Create a transformation using InputSource input XML and InputSource stylesheet- Parameters:
input- document to transformstylesheet- stylesheet to use for transformation
-
Transform
public Transform(org.xml.sax.InputSource input, java.io.File stylesheet)Create a transformation using InputSource input XML and stylesheet in a File- Parameters:
input- document to transformstylesheet- stylesheet to use for transformation
-
Transform
public Transform(org.w3c.dom.Node sourceNode)
Create a transformation that allows us to serialize a DOM Node- Parameters:
sourceNode- document to transform
-
Transform
public Transform(org.w3c.dom.Node sourceNode, java.lang.String stylesheet)Create a transformation from an input Node and stylesheet in a String- Parameters:
sourceNode- document to transformstylesheet- stylesheet to use for transformation
-
Transform
public Transform(org.w3c.dom.Node sourceNode, java.io.File stylesheet)Create a transformation from an input Node and stylesheet in a File- Parameters:
sourceNode- document to transformstylesheet- stylesheet to use for transformation
-
Transform
public Transform(javax.xml.transform.Source inputSource, javax.xml.transform.Source stylesheetSource)Create a transformation using Source input XML and Source stylesheet- Parameters:
inputSource- document to transformstylesheetSource- stylesheet to use for transformation
-
-
Method Detail
-
transformTo
protected void transformTo(javax.xml.transform.Result result) throws javax.xml.transform.TransformerExceptionPerform the actual transformation- Parameters:
result- result to output transformation result to- Throws:
javax.xml.transform.TransformerException- if transformation fails
-
getResultString
public java.lang.String getResultString() throws javax.xml.transform.TransformerExceptionPerform the XSLT transformation specified in the constructor- Returns:
- the result as a String
- Throws:
javax.xml.transform.TransformerException- if transformation fails
-
getResultDocument
public org.w3c.dom.Document getResultDocument() throws javax.xml.transform.TransformerExceptionPerform the XSLT transformation specified in the constructor- Returns:
- the result as a DOM Document
- Throws:
javax.xml.transform.TransformerException- if transformation fails
-
setOutputProperty
public void setOutputProperty(java.lang.String name, java.lang.String value)Override an output property specified in the transformation stylesheet- Parameters:
name- name of the propertyvalue- value of the property
-
setOutputProperties
public void setOutputProperties(java.util.Properties outputProperties)
Override output properties specified in the transformation stylesheet- Parameters:
outputProperties- output properties- See Also:
Transformer.setOutputProperties(java.util.Properties)
-
setParameter
public void setParameter(java.lang.String name, java.lang.Object value)Add a parameter for the transformation- Parameters:
name- name of the parametervalue- value of the parameter- See Also:
Transformer.setParameter(java.lang.String, java.lang.Object)
-
getParameter
public java.lang.Object getParameter(java.lang.String name)
See a parameter used for the transformation- Parameters:
name- name of the parameter- Returns:
- the parameter value
- See Also:
Transformer.getParameter(java.lang.String)
-
clearParameters
public void clearParameters()
Clear parameters used for the transformation- See Also:
Transformer.clearParameters()
-
setURIResolver
public void setURIResolver(javax.xml.transform.URIResolver uriResolver)
Set the URIResolver for the transformation- Parameters:
uriResolver- resolver to use- See Also:
Transformer.setURIResolver(javax.xml.transform.URIResolver)
-
setErrorListener
public void setErrorListener(javax.xml.transform.ErrorListener errorListener)
Set the ErrorListener for the transformation- Parameters:
errorListener- error listener to use- See Also:
Transformer.setErrorListener(javax.xml.transform.ErrorListener)
-
-