From 3f23dbeae5006e8a37a94c7fc40e9719b24a4d60 Mon Sep 17 00:00:00 2001 From: Jonas Partner Date: Fri, 17 Oct 2008 19:22:06 +0000 Subject: [PATCH] work in progress documentation for xml module --- spring-integration-reference/src/xml.xml | 146 +++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 spring-integration-reference/src/xml.xml diff --git a/spring-integration-reference/src/xml.xml b/spring-integration-reference/src/xml.xml new file mode 100644 index 0000000000..528ea362a1 --- /dev/null +++ b/spring-integration-reference/src/xml.xml @@ -0,0 +1,146 @@ + + + + Dealing with XML payloads + +
+ Introduction + + Spring Integration XML extends the Spring Integration Core with + implementations of splitter, transformer, selector and routers designed + to make working with XML in Spring Integration simple. The provided messaging + components are designed to work with XML represented in a range of formats including + instances of + java.lang.String, org.w3c.dom.Document + and javax.xml.transform.Source + + +
+
+ Transforming XML payloads + + This section will explain the workings of + XmlPayloadUnmarshallingTransformer, + XmlPayloadMarshallingTransformer + XsltPayloadTransformer + and how to configure them as + beans. + Also how to customise which implementation of + javax.xml.transfrom.Source + and javax.xml.Result + Finally the namespace support will be discussed. + + + XmlPayloadUnmarshallingTransformer allows an XML Source + to be unmarshalled using an implementations of Spring OXM Unmarshaller. + Spring OXM provides several implementations supporting Marshalling and Unmarshalling using JAXB, + Castor and JiBX amongest others. Since the Unmarshaller requires an instance of + Source where the message payload is not currently an instance of + Source conversion will be attempted. Currently String + and org.w3c.dom.Document payloads are supported. Custom conversion can + also be carried out by providing an implementation of SourceFactory. + + + + + + +]]> + A transformer configured as above can be used in conjunction with an instance of + MessageTransformingConsumer to consume messages from one + channel and send transformed messages to another channel. However the namespace + support discussed later conceals the need for any additional beans. + + + The XmlPayloadMarshallingTransformer allows an Object graph to be + converted into XML using a Spring OXM Marshaller. + By default the XmlPayloadMarshallingTransformer will return + a DomResult. However this can be controlled by configuring an + alternative ResultFactory such as + StringResultFactory. In many cases it will be more convenient to transform + the payload into an alternative XML format. To achieve this configure a + ResultTransformer two implementations are provided one which + converts to String and another which converts to Document + + + + + + + + + +]]> + + + XsltPayloadTransformer transforms XML payloads using XSL. + The transformer requires an instance of either Resource or + Templates. Passing in a Templates + allows for greater configuration of the Transformer used to create + the Templates instance. As in the case of + XmlPayloadMarshallingTransformer by default XsltPayloadTransformer + will create a message with a Result payload. This can be customised by + providing a ResultFactory and or a ResultTransformer. + + + + + + +]]> + + + Namespace support for all these transformers is provided in the Sprint Integration XML namespace + a template for which is below. The namespace support creates an instance of either SubscribingConsumerEndpoint + or PollingConsumerEndpoint according to the type of the provided input channel. The namespace support is designed + to reduce the amount of xml configuration by allowing the creation of an endpoint and transformer using one element. + + +]]> + So for example an XmlPayloadMarshallingTransformer can be configured as below. + ]]> + ]]> + + +
+ +
+ Routing XML payloads using XPath + + + +
+ +
+ Splitting XML payloads using XPath + + + +
+ +
+ Splitting XML payloads using XPath + + +
+ + + + +
\ No newline at end of file