Class TransformerHelper
java.lang.Object
org.springframework.xml.transform.TransformerHelper
- Since:
- 3.0
- Author:
- Arjen Poutsma
-
Constructor Summary
ConstructorDescriptionInitializes a new instance of theTransformerHelper
.TransformerHelper
(Class<? extends TransformerFactory> transformerFactoryClass) Initializes a new instance of theTransformerHelper
with the specifiedTransformerFactory
class.TransformerHelper
(TransformerFactory transformerFactory) Initializes a new instance of theTransformerHelper
with the specifiedTransformerFactory
. -
Method Summary
Modifier and TypeMethodDescriptionCreates a newTransformer
.Returns theTransformerFactory
.protected TransformerFactory
newTransformerFactory
(Class<? extends TransformerFactory> transformerFactoryClass) Instantiate a new TransformerFactory.void
setTransformerFactoryClass
(Class<? extends TransformerFactory> transformerFactoryClass) Specify theTransformerFactory
class to use.void
-
Constructor Details
-
TransformerHelper
public TransformerHelper()Initializes a new instance of theTransformerHelper
. -
TransformerHelper
Initializes a new instance of theTransformerHelper
with the specifiedTransformerFactory
. -
TransformerHelper
Initializes a new instance of theTransformerHelper
with the specifiedTransformerFactory
class.
-
-
Method Details
-
setTransformerFactoryClass
Specify theTransformerFactory
class to use. -
newTransformerFactory
protected TransformerFactory newTransformerFactory(Class<? extends TransformerFactory> transformerFactoryClass) Instantiate a new TransformerFactory.The default implementation simply calls
TransformerFactory.newInstance()
. If atransformerFactoryClass
has been specified explicitly, the default constructor of the specified class will be called instead.Can be overridden in subclasses.
- Parameters:
transformerFactoryClass
- the specified factory class (if any)- Returns:
- the new TransactionFactory instance
- See Also:
-
getTransformerFactory
Returns theTransformerFactory
.- Returns:
- the transformer factory
-
createTransformer
Creates a newTransformer
. Must be called per thread, as transformers are not thread-safe.- Returns:
- the created transformer
- Throws:
TransformerConfigurationException
- if thrown by JAXP methods
-
transform
Transforms the givenSource
to the givenResult
. Creates a newTransformer
for every call, as transformers are not thread-safe.- Parameters:
source
- the source to transform fromresult
- the result to transform to- Throws:
TransformerException
- if thrown by JAXP methods
-