org.springframework.integration.xml.transformer
Class XsltPayloadTransformer
java.lang.Object
org.springframework.integration.transformer.AbstractPayloadTransformer<java.lang.Object,java.lang.Object>
org.springframework.integration.xml.transformer.XsltPayloadTransformer
- All Implemented Interfaces:
- Transformer
public class XsltPayloadTransformer
- extends AbstractPayloadTransformer<java.lang.Object,java.lang.Object>
Thread safe XSLT transformer implementation which returns a transformed Source
,
Document
, or String
. If alwaysUseSourceResultFactories is
false (default) the following logic occurs
String
payload in results in String
payload out
Document
payload in Document
payload out
Source
payload in Result
payload out, type will be determined
by the ResultFactory
, DomResultFactory
by default. If an
instance of ResultTransformer
is registered this will be used to
convert the result.
If alwaysUseSourceResultFactories is true then the ResultFactory and
SourceFactory
will be used to create the Source
from the
payload and the Result
to pass into the transformer. An instance of
ResultTransformer
can also be provided to convert the Result prior to
returning
- Author:
- Jonas Partner, Mark Fisher
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XsltPayloadTransformer
public XsltPayloadTransformer(javax.xml.transform.Templates templates)
throws javax.xml.parsers.ParserConfigurationException
- Throws:
javax.xml.parsers.ParserConfigurationException
XsltPayloadTransformer
public XsltPayloadTransformer(javax.xml.transform.Templates templates,
ResultTransformer resultTransformer)
throws javax.xml.parsers.ParserConfigurationException
- Throws:
javax.xml.parsers.ParserConfigurationException
XsltPayloadTransformer
public XsltPayloadTransformer(org.springframework.core.io.Resource xslResource)
throws java.lang.Exception
- Throws:
java.lang.Exception
XsltPayloadTransformer
public XsltPayloadTransformer(org.springframework.core.io.Resource xslResource,
ResultTransformer resultTransformer)
throws java.lang.Exception
- Throws:
java.lang.Exception
setSourceFactory
public void setSourceFactory(SourceFactory sourceFactory)
- Parameters:
sourceFactory
-
setResultFactory
public void setResultFactory(ResultFactory resultFactory)
- Parameters:
resultFactory
-
setAlwaysUseSourceResultFactories
public void setAlwaysUseSourceResultFactories(boolean alwaysUserSourceResultFactories)
- Forces use of
ResultFactory
and SourceFactory
even for
directly supported payloads such as String
and Document
- Parameters:
alwaysUserSourceResultFactories
-
transformPayload
public java.lang.Object transformPayload(java.lang.Object payload)
throws javax.xml.transform.TransformerException
- Specified by:
transformPayload
in class AbstractPayloadTransformer<java.lang.Object,java.lang.Object>
- Throws:
javax.xml.transform.TransformerException
transformUsingFactories
protected java.lang.Object transformUsingFactories(java.lang.Object payload)
throws javax.xml.transform.TransformerException
- Throws:
javax.xml.transform.TransformerException
transformSource
protected java.lang.Object transformSource(javax.xml.transform.Source source,
java.lang.Object payload)
throws javax.xml.transform.TransformerException
- Throws:
javax.xml.transform.TransformerException
transformString
protected java.lang.String transformString(java.lang.String stringPayload)
throws javax.xml.transform.TransformerException
- Throws:
javax.xml.transform.TransformerException
transformDocument
protected org.w3c.dom.Document transformDocument(org.w3c.dom.Document documentPayload)
throws javax.xml.transform.TransformerException
- Throws:
javax.xml.transform.TransformerException