Class XsltSender
java.lang.Object
org.frankframework.senders.AbstractSender
org.frankframework.senders.AbstractSenderWithParameters
org.frankframework.senders.XsltSender
- All Implemented Interfaces:
FrankElement, HasApplicationContext, HasName, IConfigurable, IScopeProvider, ISender, ISenderWithParameters, IWithParameters, NameAware, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle
- Direct Known Subclasses:
JsonXsltSender
Perform an XSLT transformation with a specified stylesheet or XPath-expression.
- Since:
- 4.9
- Author:
- Gerrit van Brakel
- Parameters
- any parameters defined on the sender will be applied to the created transformer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final booleanFields inherited from class AbstractSenderWithParameters
parameterNamesMustBeUnique, paramListFields inherited from class AbstractSender
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTheconfigure()method instantiates a transformer for the specified XSL.protected ContentHandlercreateHandler(Message input, PipeLineSession session, TransformerPool poolToUse, ContentHandler handler, MessageBuilder messageBuilder) protected ContentHandlerfilterInput(ContentHandler input, PipeLineSession session) protected TransformerPoolgetTransformerPoolToUse(PipeLineSession session) protected XMLReadergetXmlReader(PipeLineSession session, ContentHandler handler) protected booleanisDisableOutputEscaping(TransformerPool poolToUse) @NonNull SenderResultsendMessage(@NonNull Message message, @NonNull PipeLineSession session) alternative implementation of send message, that should do the same as the original, but reuses the streaming content handlervoidsetDebugInput(boolean debugInput) Iftruethe input is written to the log file, at DEBUG levelvoidIftrue, any output is reparsed before being handled as XML again.voidsetHandleLexicalEvents(boolean b) Iftrue, the transformer is enabled to handle lexical events, allowing it for example to process comments and to distinghuish CDATA from escaped text.voidIftrue, result is pretty-printed.voidsetNamespaceDefs(String namespaceDefs) Namespace defintions for xpathExpression.voidOmit the XML declaration on top of the output.voidOnly valid for xPathExpression.voidsetRemoveNamespaces(boolean b) Iftruenamespaces (and prefixes) in the input message are removed before transformationvoidsetSkipEmptyTags(boolean b) Iftrueempty tags in the output are removed after transformationvoidsetStyleSheetCacheSize(int size) Size of cache of stylesheets retrieved from styleSheetNameSessionKeyvoidsetStyleSheetName(String stylesheetName) Location of stylesheet to apply to the input messagevoidsetStyleSheetNameSessionKey(String newSessionKey) Session key to retrieve stylesheet location.voidsetXpathExpression(String string) Alternatively: XPath-expression to create stylesheet fromvoidsetXsltVersion(int xsltVersion) If set to2or3a Saxon (net.sf.saxon) xslt processor 2.0 or 3.0 respectively will be used, otherwise xslt processor 1.0 (org.apache.xalan).voidstart()This method will be called to start the sender.voidstop()Stop/close the sender and deallocate resources.Methods inherited from class AbstractSenderWithParameters
addParameter, checkStringAttributeOrParameter, consumesSessionVariable, getParameterList, getParameterOverriddenAttributeValue, getParameterOverriddenAttributeValue, getParameterValueListMethods inherited from class AbstractSender
createBean, getLogPrefix, getName, isRunning, setApplicationContext, setNameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface FrankElement
addConfigWarningMethods inherited from interface HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface ISender
isSynchronous, sendMessageOrThrow
-
Field Details
-
DEFAULT_OUTPUT_METHOD
-
DEFAULT_XPATH_OUTPUT_METHOD
-
DEFAULT_INDENT
public static final boolean DEFAULT_INDENT- See Also:
-
DEFAULT_OMIT_XML_DECLARATION
public static final boolean DEFAULT_OMIT_XML_DECLARATION- See Also:
-
-
Constructor Details
-
XsltSender
public XsltSender()
-
-
Method Details
-
configure
Theconfigure()method instantiates a transformer for the specified XSL. If the stylesheetName cannot be accessed, a ConfigurationException is thrown.- Specified by:
configurein interfaceIConfigurable- Overrides:
configurein classAbstractSenderWithParameters- Throws:
ConfigurationException- in case it was not able to configure the component.
-
start
public void start()Description copied from interface:ISenderThis method will be called to start the sender. After this method is called the sendMessage method may be called. Purpose of this method is to reduce creating connections to databases etc. in thesendMessage()method.- Specified by:
startin interfaceISender- Specified by:
startin interfaceorg.springframework.context.Lifecycle- Overrides:
startin classAbstractSender
-
stop
public void stop()Description copied from interface:ISenderStop/close the sender and deallocate resources.- Specified by:
stopin interfaceISender- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- Overrides:
stopin classAbstractSender
-
filterInput
-
isDisableOutputEscaping
protected boolean isDisableOutputEscaping(TransformerPool poolToUse) throws TransformerException, IOException - Throws:
TransformerExceptionIOException
-
getTransformerPoolToUse
protected TransformerPool getTransformerPoolToUse(PipeLineSession session) throws SenderException, ConfigurationException -
createHandler
protected ContentHandler createHandler(Message input, PipeLineSession session, TransformerPool poolToUse, ContentHandler handler, MessageBuilder messageBuilder) throws TransformerException - Throws:
TransformerException
-
getXmlReader
protected XMLReader getXmlReader(PipeLineSession session, ContentHandler handler) throws ParserConfigurationException, SAXException -
sendMessage
public @NonNull SenderResult sendMessage(@NonNull Message message, @NonNull PipeLineSession session) throws SenderException alternative implementation of send message, that should do the same as the original, but reuses the streaming content handler- Throws:
SenderException
-
setStyleSheetName
Location of stylesheet to apply to the input message -
setStyleSheetNameSessionKey
Session key to retrieve stylesheet location. Overrides stylesheetName or xpathExpression attribute -
setStyleSheetCacheSize
public void setStyleSheetCacheSize(int size) Size of cache of stylesheets retrieved from styleSheetNameSessionKey- Default value
- 100
-
setXpathExpression
Alternatively: XPath-expression to create stylesheet from -
setOmitXmlDeclaration
Omit the XML declaration on top of the output. If not set, the value specified in the stylesheet is followed- Default value
- false, if not set in stylesheet
-
setDisableOutputEscaping
Iftrue, any output is reparsed before being handled as XML again. If not set, the stylesheet is searched for@disable-output-escaping='yes'and the value is set accordingly- Default value
- false, if not set in stylesheet
-
setNamespaceDefs
Namespace defintions for xpathExpression. Must be in the form of a comma or space separated list ofprefix=namespaceuri-definitions. For some other use cases (NOT xpathExpression), one entry can be without a prefix, that will define the default namespace. If left empty, the xpathExpression will match any namespace -
setOutputType
Only valid for xPathExpression. If outputType isTransformerPool.OutputType.XMLthen the resulting stylesheet will use thecopy-ofmethod instead ofvalue-of. This field controls how to read the input and does not determine the output.- Default value
- text
-
setIndentXml
Iftrue, result is pretty-printed. If not set, the value specified in the stylesheet is followed- Default value
- false, if not set in stylesheet
-
setRemoveNamespaces
public void setRemoveNamespaces(boolean b) Iftruenamespaces (and prefixes) in the input message are removed before transformation- Default value
- false
-
setHandleLexicalEvents
public void setHandleLexicalEvents(boolean b) Iftrue, the transformer is enabled to handle lexical events, allowing it for example to process comments and to distinghuish CDATA from escaped text. Beware that this option can cause spurious NullPointerExceptions due to a race condition in streaming XSLT 1.0 processing in Xalan 2.7.2- Default value
- false
-
setSkipEmptyTags
public void setSkipEmptyTags(boolean b) Iftrueempty tags in the output are removed after transformation- Default value
- false
-
setXsltVersion
public void setXsltVersion(int xsltVersion) If set to2or3a Saxon (net.sf.saxon) xslt processor 2.0 or 3.0 respectively will be used, otherwise xslt processor 1.0 (org.apache.xalan).0will auto-detect- Default value
- 0
-
setDebugInput
public void setDebugInput(boolean debugInput) Iftruethe input is written to the log file, at DEBUG level- Default value
- false
-