You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2017/08/25 08:22:03 UTC

svn commit: r1017260 [7/40] - in /websites/production/camel/content: ./ cache/

Modified: websites/production/camel/content/book-dataformat-appendix.html
==============================================================================
--- websites/production/camel/content/book-dataformat-appendix.html (original)
+++ websites/production/camel/content/book-dataformat-appendix.html Fri Aug 25 08:22:01 2017
@@ -201,136 +201,45 @@ from("file://foo/bar").
 <h3 id="BookDataFormatAppendix-Dependencies">Dependencies</h3>
 
 <p>This data format is provided in <strong>camel-core</strong> so no additional dependencies is needed.</p>
-<h2 id="BookDataFormatAppendix-JAXB">JAXB</h2><p>JAXB is a <a shape="rect" href="data-format.html">Data Format</a> which uses the JAXB2 XML marshalling standard which is included in Java 6 to unmarshal an XML payload into Java objects or to marshal Java objects into an XML payload.</p><h3 id="BookDataFormatAppendix-UsingtheJavaDSL">Using the Java DSL</h3><p>For example the following uses a named DataFormat of <em>jaxb</em> which is configured with a number of Java package names to initialize the <a shape="rect" class="external-link" href="http://java.sun.com/javase/6/docs/api/javax/xml/bind/JAXBContext.html" rel="nofollow">JAXBContext</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[DataFormat jaxb = new JaxbDataFormat(&quot;com.acme.model&quot;);
+<h2 id="BookDataFormatAppendix-JAXB">JAXB</h2><p>JAXB is a <a shape="rect" href="data-format.html">Data Format</a> which uses the JAXB2 XML marshalling standard which is included in Java 6 to unmarshal an XML payload into Java objects or to marshal Java objects into an XML payload.</p><h3 id="BookDataFormatAppendix-UsingtheJavaDSL">Using the Java DSL</h3><p>For example the following uses a named DataFormat of <em>jaxb</em> which is configured with a number of Java package names to initialize the <a shape="rect" class="external-link" href="http://java.sun.com/javase/6/docs/api/javax/xml/bind/JAXBContext.html" rel="nofollow">JAXBContext</a>.</p><plain-text-body>DataFormat jaxb = new JaxbDataFormat("com.acme.model");
 
-from(&quot;activemq:My.Queue&quot;).
+from("activemq:My.Queue").
   unmarshal(jaxb).
-  to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><p>You can if you prefer use a named reference to a data format which can then be defined in your <a shape="rect" href="registry.html">Registry</a> such as via your <a shape="rect" href="spring.html">Spring</a> XML file. e.g.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from(&quot;activemq:My.Queue&quot;).
-  unmarshal(&quot;myJaxbDataType&quot;).
-  to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-UsingSpringXML.1">Using Spring XML</h3><p>The following example shows how to use JAXB to unmarshal using <a shape="rect" href="spring.html">Spring</a> configuring the jaxb data type</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel&quot; xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;unmarshal&gt;
-      &lt;jaxb prettyPrint=&quot;true&quot; contextPath=&quot;org.apache.camel.example&quot;/&gt;
-    &lt;/unmarshal&gt;
-    &lt;to uri=&quot;mock:result&quot;/&gt;
-  &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div>This example shows how to configure the data type just once and reuse it on multiple routes.<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel&quot; xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;dataFormats&gt;
-    &lt;jaxb id=&quot;myJaxb&quot; prettyPrint=&quot;true&quot; contextPath=&quot;org.apache.camel.example&quot;/&gt;
-  &lt;/dataFormats&gt;
-
-  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;marshal ref=&quot;myJaxb&quot;/&gt;
-    &lt;to uri=&quot;direct:marshalled&quot;/&gt;
-  &lt;/route&gt;
-  &lt;route&gt;
-    &lt;from uri=&quot;direct:marshalled&quot;/&gt;
-    &lt;unmarshal ref=&quot;myJaxb&quot;/&gt;
-    &lt;to uri=&quot;mock:result&quot;/&gt;
-  &lt;/route&gt;
-
-&lt;/camelContext&gt;
-]]></script>
-</div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Multiple context paths</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>It is possible to use this data format with more than one context path. You can specify context path using <code>:</code> as separator, for example <code>com.mycompany:com.mycompany2</code>. Note that this is handled by JAXB implementation and might change if you use different vendor than RI.</p></div></div><h3 id="BookDataFormatAppendix-Partialmarshalling/unmarshalling">Partial marshalling/unmarshalling</h3><p><strong>This feature is new to Camel 2.2.0.</strong><br clear="none"> JAXB 2 supports marshalling and unmarshalling XML tree fragments. By default JAXB looks for <code>@XmlRootElement</code> annotation on given class to operate on whole XML tree. This is useful but not always - sometimes generated cod
 e does not have @XmlRootElement annotation, sometimes you need unmarshall only part of tree.<br clear="none"> In that case you can use partial unmarshalling. To enable this behaviours you need set property <code>partClass</code>. Camel will pass this class to JAXB's unmarshaler.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel&quot; xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:marshal&quot;/&gt;
-        &lt;marshal&gt;
-            &lt;jaxb prettyPrint=&quot;false&quot; contextPath=&quot;org.apache.camel.example&quot;
-                partClass=&quot;org.apache.camel.example.PurchaseOrder&quot;
-                fragment=&quot;true&quot;
-                partNamespace=&quot;{http://example.camel.org/apache}po&quot; /&gt;
-        &lt;/marshal&gt;
-        &lt;to uri=&quot;mock:marshal&quot;/&gt;
-    &lt;/route&gt;
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:unmarshal&quot;/&gt;
-        &lt;unmarshal&gt;
-            &lt;jaxb prettyPrint=&quot;false&quot; contextPath=&quot;org.apache.camel.example&quot;
-                partClass=&quot;org.apache.camel.example.Partial&quot; /&gt;
-        &lt;/unmarshal&gt;
-        &lt;to uri=&quot;mock:unmarshal&quot;/&gt;
-    &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div>For marshalling you have to add <code>partNamespace</code> attribute with QName of destination namespace. Example of Spring DSL you can find above.<h3 id="BookDataFormatAppendix-Fragment">Fragment</h3><p><strong>This feature is new to Camel 2.8.0.</strong><br clear="none"> JaxbDataFormat has new property fragment which can set the the <code>Marshaller.JAXB_FRAGMENT</code> encoding property on the JAXB Marshaller. If you don't want the JAXB Marshaller to generate the XML declaration, you can set this option to be true. The default value of this property is false.</p><h3 id="BookDataFormatAppendix-IgnoringtheNonXMLCharacter">Ignoring the NonXML Character</h3><p><strong>This feature is new to Camel 2.2.0.</strong><br clear="none"> JaxbDataFromat supports to ignore the <a shape="rect" class="external-link" href="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-Char" rel="nofollow">NonXML Character</a>, you just need to set the filterNonXmlChars property to be true, JaxbDataFor
 mat will replace the NonXML character with " " when it is marshaling or unmarshaling the message. You can also do it by setting the <a shape="rect" href="exchange.html">Exchange</a> property <code>Exchange.FILTER_NON_XML_CHARS</code>.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><th colspan="1" rowspan="1" class="confluenceTh"><p>JDK 1.5</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>JDK 1.6+</p></th></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Filtering in use</p></th><td colspan="1" rowspan="1" class="confluenceTd"><p>StAX API and implementation</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>No</p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Filtering not in use</p></th><td colspan="1" rowspan="1" class="confluenceTd"><p>StAX API only</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>No</p></td></tr></tbody></table></di
 v><p>This feature has been tested with Woodstox 3.2.9 and Sun JDK 1.6 StAX implementation.</p><p><strong>New for Camel 2.12.1</strong><br clear="none"> JaxbDataFormat now allows you to customize the XMLStreamWriter used to marshal the stream to XML. Using this configuration, you can add your own stream writer to completely remove, escape, or replace non-xml characters.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[   JaxbDataFormat customWriterFormat = new JaxbDataFormat(&quot;org.apache.camel.foo.bar&quot;);
+  to("mqseries:Another.Queue");
+</plain-text-body><p>You can if you prefer use a named reference to a data format which can then be defined in your <a shape="rect" href="registry.html">Registry</a> such as via your <a shape="rect" href="spring.html">Spring</a> XML file. e.g.</p><plain-text-body>from("activemq:My.Queue").
+  unmarshal("myJaxbDataType").
+  to("mqseries:Another.Queue");
+</plain-text-body><h3 id="BookDataFormatAppendix-UsingSpringXML.1">Using Spring XML</h3><p>The following example shows how to use JAXB to unmarshal using <a shape="rect" href="spring.html">Spring</a> configuring the jaxb data type<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-jaxb/src/test/resources/org/apache/camel/example/springDataFormat.xml}</plain-text-body>This example shows how to configure the data type just once and reuse it on multiple routes.<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-jaxb/src/test/resources/org/apache/camel/example/marshalAndUnmarshalWithRef.xml}</plain-text-body></p><parameter ac:name="title">Multiple context paths</parameter><rich-text-body><p>It is possible to use this data format with more than one context path. You can specify context path using <code>:</code> as separator, for example <code>com.mycompany:com.mycompany2</code>. Note that this is handled by JAXB implementation and mig
 ht change if you use different vendor than RI.</p></rich-text-body><h3 id="BookDataFormatAppendix-Partialmarshalling/unmarshalling">Partial marshalling/unmarshalling</h3><p><strong>This feature is new to Camel 2.2.0.</strong><br clear="none"> JAXB 2 supports marshalling and unmarshalling XML tree fragments. By default JAXB looks for <code>@XmlRootElement</code> annotation on given class to operate on whole XML tree. This is useful but not always - sometimes generated code does not have @XmlRootElement annotation, sometimes you need unmarshall only part of tree.<br clear="none"> In that case you can use partial unmarshalling. To enable this behaviours you need set property <code>partClass</code>. Camel will pass this class to JAXB's unmarshaler.<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-jaxb/src/test/resources/org/apache/camel/example/springDataFormatPartial.xml}</plain-text-body>For marshalling you have to add <code>partNamespace</code> attribute 
 with QName of destination namespace. Example of Spring DSL you can find above.</p><h3 id="BookDataFormatAppendix-Fragment">Fragment</h3><p><strong>This feature is new to Camel 2.8.0.</strong><br clear="none"> JaxbDataFormat has new property fragment which can set the the <code>Marshaller.JAXB_FRAGMENT</code> encoding property on the JAXB Marshaller. If you don't want the JAXB Marshaller to generate the XML declaration, you can set this option to be true. The default value of this property is false.</p><h3 id="BookDataFormatAppendix-IgnoringtheNonXMLCharacter">Ignoring the NonXML Character</h3><p><strong>This feature is new to Camel 2.2.0.</strong><br clear="none"> JaxbDataFromat supports to ignore the <a shape="rect" class="external-link" href="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-Char" rel="nofollow">NonXML Character</a>, you just need to set the filterNonXmlChars property to be true, JaxbDataFormat will replace the NonXML character with " " when it is marshaling or unmar
 shaling the message. You can also do it by setting the <a shape="rect" href="exchange.html">Exchange</a> property <code>Exchange.FILTER_NON_XML_CHARS</code>.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><th colspan="1" rowspan="1" class="confluenceTh"><p>JDK 1.5</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>JDK 1.6+</p></th></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Filtering in use</p></th><td colspan="1" rowspan="1" class="confluenceTd"><p>StAX API and implementation</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>No</p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Filtering not in use</p></th><td colspan="1" rowspan="1" class="confluenceTd"><p>StAX API only</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>No</p></td></tr></tbody></table></div><p>This feature has been tested with Woodstox 3.2.9 and Sun JDK 1.6 StAX im
 plementation.</p><p><strong>New for Camel 2.12.1</strong><br clear="none"> JaxbDataFormat now allows you to customize the XMLStreamWriter used to marshal the stream to XML. Using this configuration, you can add your own stream writer to completely remove, escape, or replace non-xml characters.</p><parameter ac:name="language">java</parameter><plain-text-body>   JaxbDataFormat customWriterFormat = new JaxbDataFormat("org.apache.camel.foo.bar");
   customWriterFormat.setXmlStreamWriterWrapper(new TestXmlStreamWriter());
-]]></script>
-</div></div><p>The following example shows using the Spring DSL and also enabling Camel's NonXML filtering:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;testXmlStreamWriterWrapper&quot; class=&quot;org.apache.camel.jaxb.TestXmlStreamWriter&quot;/&gt;
-&lt;jaxb filterNonXmlChars=&quot;true&quot;  contextPath=&quot;org.apache.camel.foo.bar&quot; xmlStreamWriterWrapper=&quot;#testXmlStreamWriterWrapper&quot; /&gt;
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-WorkingwiththeObjectFactory">Working with the ObjectFactory</h3><p>If you use XJC to create the java class from the schema, you will get an ObjectFactory for you JAXB context. Since the ObjectFactory uses <a shape="rect" class="external-link" href="http://java.sun.com/javase/6/docs/api/javax/xml/bind/JAXBElement.html" rel="nofollow">JAXBElement</a> to hold the reference of the schema and element instance value, jaxbDataformat will ignore the JAXBElement by default and you will get the element instance value instead of the JAXBElement object form the unmarshaled message body. <br clear="none"> If you want to get the JAXBElement object form the unmarshaled message body, you need to set the JaxbDataFormat object's ignoreJAXBElement property to be false.</p><h3 id="BookDataFormatAppendix-Settingencoding">Setting encoding</h3><p>You can set the <strong>encoding</strong> option to use when marshalling. Its the <code>Marshaller.JAXB_ENCODING</code
 > encoding property on the JAXB Marshaller.<br clear="none"> You can setup which encoding to use when you declare the JAXB data format. You can also provide the encoding in the <a shape="rect" href="exchange.html">Exchange</a> property <code>Exchange.CHARSET_NAME</code>. This property will overrule the encoding set on the JAXB data format.</p><p>In this Spring DSL we have defined to use <code>iso-8859-1</code> as the encoding:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel&quot; xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:start&quot;/&gt;
-        &lt;marshal&gt;
-            &lt;jaxb prettyPrint=&quot;false&quot; encoding=&quot;iso-8859-1&quot; contextPath=&quot;org.apache.camel.example&quot;/&gt;
-        &lt;/marshal&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
-    &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-Controllingnamespaceprefixmapping">Controlling namespace prefix mapping</h3><p><strong>Available as of Camel 2.11</strong></p><p>When marshalling using <a shape="rect" href="jaxb.html">JAXB</a> or <a shape="rect" href="soap.html">SOAP</a> then the JAXB implementation will automatic assign namespace prefixes, such as ns2, ns3, ns4 etc. To control this mapping, Camel allows you to refer to a map which contains the desired mapping.</p><p>Notice this requires having JAXB-RI 2.1 or better (from SUN) on the classpath, as the mapping functionality is dependent on the implementation of JAXB, whether its supported.</p><p>For example in Spring XML we can define a Map with the mapping. In the mapping file below, we map SOAP to use soap as prefix. While our custom namespace "http://www.mycompany.com/foo/2" is not using any prefix.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[  &lt;util:map id=&quot;myMap&quot;&gt;
-    &lt;entry key=&quot;http://www.w3.org/2003/05/soap-envelope&quot; value=&quot;soap&quot;/&gt;
+</plain-text-body><p>The following example shows using the Spring DSL and also enabling Camel's NonXML filtering:</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;bean id="testXmlStreamWriterWrapper" class="org.apache.camel.jaxb.TestXmlStreamWriter"/&gt;
+&lt;jaxb filterNonXmlChars="true"  contextPath="org.apache.camel.foo.bar" xmlStreamWriterWrapper="#testXmlStreamWriterWrapper" /&gt;
+</plain-text-body><h3 id="BookDataFormatAppendix-WorkingwiththeObjectFactory">Working with the ObjectFactory</h3><p>If you use XJC to create the java class from the schema, you will get an ObjectFactory for you JAXB context. Since the ObjectFactory uses <a shape="rect" class="external-link" href="http://java.sun.com/javase/6/docs/api/javax/xml/bind/JAXBElement.html" rel="nofollow">JAXBElement</a> to hold the reference of the schema and element instance value, jaxbDataformat will ignore the JAXBElement by default and you will get the element instance value instead of the JAXBElement object form the unmarshaled message body. <br clear="none"> If you want to get the JAXBElement object form the unmarshaled message body, you need to set the JaxbDataFormat object's ignoreJAXBElement property to be false.</p><h3 id="BookDataFormatAppendix-Settingencoding">Setting encoding</h3><p>You can set the <strong>encoding</strong> option to use when marshalling. Its the <code>Marshaller.JAXB_ENCODING
 </code> encoding property on the JAXB Marshaller.<br clear="none"> You can setup which encoding to use when you declare the JAXB data format. You can also provide the encoding in the <a shape="rect" href="exchange.html">Exchange</a> property <code>Exchange.CHARSET_NAME</code>. This property will overrule the encoding set on the JAXB data format.</p><p>In this Spring DSL we have defined to use <code>iso-8859-1</code> as the encoding:<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-jaxb/src/test/resources/org/apache/camel/example/springDataFormatWithEncoding.xml}</plain-text-body></p><h3 id="BookDataFormatAppendix-Controllingnamespaceprefixmapping">Controlling namespace prefix mapping</h3><p><strong>Available as of Camel 2.11</strong></p><p>When marshalling using <a shape="rect" href="jaxb.html">JAXB</a> or <a shape="rect" href="soap.html">SOAP</a> then the JAXB implementation will automatic assign namespace prefixes, such as ns2, ns3, ns4 etc. To control
  this mapping, Camel allows you to refer to a map which contains the desired mapping.</p><p>Notice this requires having JAXB-RI 2.1 or better (from SUN) on the classpath, as the mapping functionality is dependent on the implementation of JAXB, whether its supported.</p><p>For example in Spring XML we can define a Map with the mapping. In the mapping file below, we map SOAP to use soap as prefix. While our custom namespace "http://www.mycompany.com/foo/2" is not using any prefix.</p><parameter ac:name="">xml</parameter><plain-text-body>  &lt;util:map id="myMap"&gt;
+    &lt;entry key="http://www.w3.org/2003/05/soap-envelope" value="soap"/&gt;
     &lt;!-- we dont want any prefix for our namespace --&gt;
-    &lt;entry key=&quot;http://www.mycompany.com/foo/2&quot; value=&quot;&quot;/&gt;
+    &lt;entry key="http://www.mycompany.com/foo/2" value=""/&gt;
   &lt;/util:map&gt;
-]]></script>
-</div></div><p>To use this in <a shape="rect" href="jaxb.html">JAXB</a> or <a shape="rect" href="soap.html">SOAP</a> you refer to this map, using the <code>namespacePrefixRef</code> attribute as shown below. Then Camel will lookup in the <a shape="rect" href="registry.html">Registry</a> a <code>java.util.Map</code> with the id "myMap", which was what we defined above.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[  &lt;marshal&gt;
-    &lt;soapjaxb version=&quot;1.2&quot; contextPath=&quot;com.mycompany.foo&quot; namespacePrefixRef=&quot;myMap&quot;/&gt;
+</plain-text-body><p>To use this in <a shape="rect" href="jaxb.html">JAXB</a> or <a shape="rect" href="soap.html">SOAP</a> you refer to this map, using the <code>namespacePrefixRef</code> attribute as shown below. Then Camel will lookup in the <a shape="rect" href="registry.html">Registry</a> a <code>java.util.Map</code> with the id "myMap", which was what we defined above.</p><parameter ac:name="">xml</parameter><plain-text-body>  &lt;marshal&gt;
+    &lt;soapjaxb version="1.2" contextPath="com.mycompany.foo" namespacePrefixRef="myMap"/&gt;
   &lt;/marshal&gt;
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-Schemavalidation">Schema validation</h3><p><strong>Available as of Camel 2.11</strong></p><p>The JAXB <a shape="rect" href="data-format.html">Data Format</a> supports validation by marshalling and unmarshalling from/to XML. Your can use the prefix <strong>classpath:</strong>, <strong>file:* or *http:</strong> to specify how the resource should by resolved. You can separate multiple schema files by using the <strong>','</strong> character.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Known issue</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Camel 2.11.0 and 2.11.1 has a known issue by validation multiple <code>Exchange</code>'s in parallel. See <a shape="rect" class="external-link" href="https://issues.apache.org/jira/browse/CAMEL-6630">CAMEL-6630</a>. This is fixed with Camel 2.11.
 2/2.12.0.</p></div></div><p>Using the Java DSL, you can configure it in the following way:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
+</plain-text-body><h3 id="BookDataFormatAppendix-Schemavalidation">Schema validation</h3><p><strong>Available as of Camel 2.11</strong></p><p>The JAXB <a shape="rect" href="data-format.html">Data Format</a> supports validation by marshalling and unmarshalling from/to XML. Your can use the prefix <strong>classpath:</strong>, <strong>file:* or *http:</strong> to specify how the resource should by resolved. You can separate multiple schema files by using the <strong>','</strong> character.</p><parameter ac:name="title">Known issue</parameter><rich-text-body><p>Camel 2.11.0 and 2.11.1 has a known issue by validation multiple <code>Exchange</code>'s in parallel. See <a shape="rect" class="external-link" href="https://issues.apache.org/jira/browse/CAMEL-6630">CAMEL-6630</a>. This is fixed with Camel 2.11.2/2.12.0.</p></rich-text-body><p>Using the Java DSL, you can configure it in the following way:</p><parameter ac:name="">java</parameter><plain-text-body>JaxbDataFormat jaxbDataFormat = n
 ew JaxbDataFormat();
 jaxbDataFormat.setContextPath(Person.class.getPackage().getName());
-jaxbDataFormat.setSchema(&quot;classpath:person.xsd,classpath:address.xsd&quot;);
-]]></script>
-</div></div><p>You can do the same using the XML DSL:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;marshal&gt;
-    &lt;jaxb id=&quot;jaxb&quot; schema=&quot;classpath:person.xsd,classpath:address.xsd&quot;/&gt;
+jaxbDataFormat.setSchema("classpath:person.xsd,classpath:address.xsd");
+</plain-text-body><p>You can do the same using the XML DSL:</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;marshal&gt;
+    &lt;jaxb id="jaxb" schema="classpath:person.xsd,classpath:address.xsd"/&gt;
 &lt;/marshal&gt;
-]]></script>
-</div></div><p>Camel will create and pool the underling <code>SchemaFactory</code> instances on the fly, because the <code>SchemaFactory</code> shipped with the JDK is not thread safe.<br clear="none"> However, if you have a <code>SchemaFactory</code> implementation which is thread safe, you can configure the JAXB data format to use this one:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
+</plain-text-body><p>Camel will create and pool the underling <code>SchemaFactory</code> instances on the fly, because the <code>SchemaFactory</code> shipped with the JDK is not thread safe.<br clear="none"> However, if you have a <code>SchemaFactory</code> implementation which is thread safe, you can configure the JAXB data format to use this one:</p><parameter ac:name="">java</parameter><plain-text-body>JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
 jaxbDataFormat.setSchemaFactory(thradSafeSchemaFactory);
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-SchemaLocation">Schema Location</h3><p><strong>Available as of Camel 2.14</strong></p><p>The JAXB&#160;<a shape="rect" href="data-format.html">Data Format</a>&#160;supports to specify the SchemaLocation when marshaling the XML.&#160;</p><p>Using the Java DSL, you can configure it in the following way:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
+</plain-text-body><h3 id="BookDataFormatAppendix-SchemaLocation">Schema Location</h3><p><strong>Available as of Camel 2.14</strong></p><p>The JAXB&#160;<a shape="rect" href="data-format.html">Data Format</a>&#160;supports to specify the SchemaLocation when marshaling the XML.&#160;</p><p>Using the Java DSL, you can configure it in the following way:</p><parameter ac:name="">java</parameter><plain-text-body>JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
 jaxbDataFormat.setContextPath(Person.class.getPackage().getName());
-jaxbDataFormat.setSchemaLocation(&quot;schema/person.xsd&quot;);
-]]></script>
-</div></div><p>You can do the same using the XML DSL:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;marshal&gt;
-    &lt;jaxb id=&quot;jaxb&quot; schemaLocation=&quot;schema/person.xsd&quot;/&gt;
-&lt;/marshal&gt;]]></script>
-</div></div><h3 id="BookDataFormatAppendix-MarshaldatathatisalreadyXML">Marshal data that is already XML</h3><p><strong>Available as of Camel 2.14.1</strong></p><div>The JAXB marshaller requires that the message body is JAXB compatible, eg its a JAXBElement, eg a java instance that has JAXB annotations, or extend JAXBElement. There can be situations where the message body is already in XML, eg from a String type. There is a new option&#160;<code>mustBeJAXBElement</code> you can set to false, to relax this check, so the JAXB marshaller only attempts to marshal JAXBElements (javax.xml.bind.JAXBIntrospector#isElement returns true). And in those situations the marshaller fallbacks to marshal the message body as-is.</div><div><h3 id="BookDataFormatAppendix-XmlRootElementobjects"><span style="color: rgb(51,51,51);">XmlRootElement objects</span></h3><p><strong>Available as of Camel 2.17.2</strong></p><p>The JAXB <a shape="rect" href="data-format.html">Data Format</a> option objectFactory h
 as a default value equals to false. This is related to a performance degrading. For more information look at the issue <a shape="rect" class="external-link" href="https://issues.apache.org/jira/browse/CAMEL-10043">CAMEL-10043</a></p><p>For the marshalling of <span style="color: rgb(51,51,51);">non-XmlRootElement JaxB objects</span> you'll need to <span style="color: rgb(51,51,51);">call JaxbDataFormat#setObjectFactory(true)</span></p></div><h3 id="BookDataFormatAppendix-Dependencies.1">Dependencies</h3><p>To use JAXB in your camel routes you need to add the a dependency on <strong>camel-jaxb</strong> which implements this data format.</p><p>If you use maven you could just add the following to your pom.xml, substituting the version number for the latest &amp; greatest release (see <a shape="rect" href="download.html">the download page for the latest versions</a>).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+jaxbDataFormat.setSchemaLocation("schema/person.xsd");
+</plain-text-body><p>You can do the same using the XML DSL:</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;marshal&gt;
+    &lt;jaxb id="jaxb" schemaLocation="schema/person.xsd"/&gt;
+&lt;/marshal&gt;</plain-text-body><h3 id="BookDataFormatAppendix-MarshaldatathatisalreadyXML">Marshal data that is already XML</h3><p><strong>Available as of Camel 2.14.1</strong></p><div>The JAXB marshaller requires that the message body is JAXB compatible, eg its a JAXBElement, eg a java instance that has JAXB annotations, or extend JAXBElement. There can be situations where the message body is already in XML, eg from a String type. There is a new option&#160;<code>mustBeJAXBElement</code> you can set to false, to relax this check, so the JAXB marshaller only attempts to marshal JAXBElements (javax.xml.bind.JAXBIntrospector#isElement returns true). And in those situations the marshaller fallbacks to marshal the message body as-is.</div><div><h3 id="BookDataFormatAppendix-XmlRootElementobjects"><span style="color: rgb(51,51,51);">XmlRootElement objects</span></h3><p><strong>Available as of Camel 2.17.2</strong></p><p>The JAXB <a shape="rect" href="data-format.html">Data Format</a> 
 option objectFactory has a default value equals to false. This is related to a performance degrading. For more information look at the issue <a shape="rect" class="external-link" href="https://issues.apache.org/jira/browse/CAMEL-10043">CAMEL-10043</a></p><p>For the marshalling of <span style="color: rgb(51,51,51);">non-XmlRootElement JaxB objects</span> you'll need to <span style="color: rgb(51,51,51);">call JaxbDataFormat#setObjectFactory(true)</span></p></div><h3 id="BookDataFormatAppendix-Dependencies.1">Dependencies</h3><p>To use JAXB in your camel routes you need to add the a dependency on <strong>camel-jaxb</strong> which implements this data format.</p><p>If you use maven you could just add the following to your pom.xml, substituting the version number for the latest &amp; greatest release (see <a shape="rect" href="download.html">the download page for the latest versions</a>).</p><plain-text-body>&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-jaxb&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div>
+</plain-text-body>
 <h2 id="BookDataFormatAppendix-XmlBeans">XmlBeans</h2>
 
 <p>XmlBeans is a <a shape="rect" href="data-format.html">Data Format</a> which uses the <a shape="rect" class="external-link" href="http://xmlbeans.apache.org/">XmlBeans library</a> to unmarshal an XML payload into Java objects or to marshal Java objects into an XML payload.</p>
@@ -359,69 +268,35 @@ from(&quot;activemq:My.Queue&quot;).
 &lt;/dependency&gt;
 ]]></script>
 </div></div>
-<h2 id="BookDataFormatAppendix-XStream">XStream</h2><p>XStream is a <a shape="rect" href="data-format.html">Data Format</a> which uses the <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> to marshal and unmarshal Java objects to and from XML.</p><p>To use XStream in your camel routes you need to add the a dependency on&#160;<strong>camel-xstream</strong>&#160;which implements this data format.</p><p>Maven users will need to add the following dependency to their <code>pom.xml</code>&#160;for this component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+<h2 id="BookDataFormatAppendix-XStream">XStream</h2><p>XStream is a <a shape="rect" href="data-format.html">Data Format</a> which uses the <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> to marshal and unmarshal Java objects to and from XML.</p><p>To use XStream in your camel routes you need to add the a dependency on&#160;<strong>camel-xstream</strong>&#160;which implements this data format.</p><p>Maven users will need to add the following dependency to their <code>pom.xml</code>&#160;for this component:</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-xstream&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
   &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-UsingtheJavaDSL.1">Using the Java DSL</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// lets turn Object messages into XML then send to MQSeries
-from(&quot;activemq:My.Queue&quot;).
+</plain-text-body><h3 id="BookDataFormatAppendix-UsingtheJavaDSL.1">Using the Java DSL</h3><plain-text-body>// lets turn Object messages into XML then send to MQSeries
+from("activemq:My.Queue").
   marshal().xstream().
-  to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><p>If you would like to configure the <code>XStream</code> instance used by the Camel for the message transformation, you can simply pass a reference to that instance on the DSL level.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[XStream xStream = new XStream();
-xStream.aliasField(&quot;money&quot;, PurchaseOrder.class, &quot;cash&quot;);
+  to("mqseries:Another.Queue");
+</plain-text-body><p>If you would like to configure the <code>XStream</code> instance used by the Camel for the message transformation, you can simply pass a reference to that instance on the DSL level.</p><plain-text-body>XStream xStream = new XStream();
+xStream.aliasField("money", PurchaseOrder.class, "cash");
 // new Added setModel option since Camel 2.14
-xStream.setModel(&quot;NO_REFERENCES&quot;);
+xStream.setModel("NO_REFERENCES");
 ...
 
-from(&quot;direct:marshal&quot;).
+from("direct:marshal").
   marshal(new XStreamDataFormat(xStream)).
-  to(&quot;mock:marshaled&quot;);
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-XMLInputFactoryandXMLOutputFactory">XMLInputFactory and XMLOutputFactory</h3><p><a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">The XStream library</a> uses the <code>javax.xml.stream.XMLInputFactory</code> and <code>javax.xml.stream.XMLOutputFactory</code>, you can control which implementation of this factory should be used.</p><p>The Factory is discovered using this algorithm:<br clear="none"> 1. Use the <code>javax.xml.stream.XMLInputFactory</code> , <code>javax.xml.stream.XMLOutputFactory</code> system property.<br clear="none"> 2. Use the <code>lib/xml.stream.properties</code> file in the <code>JRE_HOME</code> directory.<br clear="none"> 3. Use the Services API, if available, to determine the classname by looking in the <code>META-INF/services/javax.xml.stream.XMLInputFactory</code>, <code>META-INF/services/javax.xml.stream.XMLOutputFactory</code> files in jars available to the JRE.<br clear="no
 ne"> 4. Use the platform default XMLInputFactory,XMLOutputFactory instance.</p><h3 id="BookDataFormatAppendix-HowtosettheXMLencodinginXstreamDataFormat?">How to set the XML encoding in Xstream DataFormat?</h3><p>From Camel 2.2.0, you can set the encoding of XML in Xstream DataFormat by setting the Exchange's property with the key <code>Exchange.CHARSET_NAME</code>, or setting the encoding property on Xstream from DSL or Spring config.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from(&quot;activemq:My.Queue&quot;).
-  marshal().xstream(&quot;UTF-8&quot;).
-  to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><p></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel&quot; xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    
-    &lt;!-- we define the json xstream data formats to be used (xstream is default) --&gt;
-    &lt;dataFormats&gt;
-        &lt;xstream id=&quot;xstream-utf8&quot; encoding=&quot;UTF-8&quot; permissions=&quot;org.apache.camel.dataformat.stream.*&quot;/&gt;
-        &lt;xstream id=&quot;xstream-default&quot; permissions=&quot;org.apache.camel.dataformat.stream.*&quot;/&gt;
-    &lt;/dataFormats&gt;
-
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:in&quot;/&gt;
-        &lt;marshal ref=&quot;xstream-default&quot;/&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
-    &lt;/route&gt;
-
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:in-UTF-8&quot;/&gt;
-        &lt;marshal ref=&quot;xstream-utf8&quot;/&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
-    &lt;/route&gt;
-
-&lt;/camelContext&gt;
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-SettingthetypepermissionsofXstreamDataFormat">Setting the type permissions of Xstream DataFormat</h3><p>In Camel, one can always use its own processing step in the route to filter and block certain XML documents to be routed to the XStream's unmarhall step. From Camel 2.16.1, 2.15.5, you can set&#160;<a shape="rect" class="external-link" href="http://x-stream.github.io/security.html" rel="nofollow">XStream's type permissions</a>&#160;to automatically allow or deny the instantiation of certain types.</p><p>The default type permissions setting used by Camel denies all types except for those from java.lang and java.util packages. This setting can be changed by setting System property org.apache.camel.xstream.permissions. Its value is a string of comma-separated permission terms, each representing a type being allowed or denied, depending on whether the term is prefixed with '+' (note '+' may be omitted) or with '-', respectively.</p><p>Each te
 rm may contain a wildcard character '*'. For example, value "-*,java.lang.*,java.util.*" indicates denying all types except for java.lang.* and java.util.* classes. Setting this value to an empty string "" reverts to the default XStream's type permissions handling which denies certain blacklisted classes and allow others.</p><p>The type permissions setting can be extended at an individual XStream DataFormat instance by setting its type permissions property.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    &lt;dataFormats&gt;
-        &lt;xstream id=&quot;xstream-default&quot; 
-                 permissions=&quot;org.apache.camel.samples.xstream.*&quot;/&gt;
+  to("mock:marshaled");
+</plain-text-body><h3 id="BookDataFormatAppendix-XMLInputFactoryandXMLOutputFactory">XMLInputFactory and XMLOutputFactory</h3><p><a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">The XStream library</a> uses the <code>javax.xml.stream.XMLInputFactory</code> and <code>javax.xml.stream.XMLOutputFactory</code>, you can control which implementation of this factory should be used.</p><p>The Factory is discovered using this algorithm:<br clear="none"> 1. Use the <code>javax.xml.stream.XMLInputFactory</code> , <code>javax.xml.stream.XMLOutputFactory</code> system property.<br clear="none"> 2. Use the <code>lib/xml.stream.properties</code> file in the <code>JRE_HOME</code> directory.<br clear="none"> 3. Use the Services API, if available, to determine the classname by looking in the <code>META-INF/services/javax.xml.stream.XMLInputFactory</code>, <code>META-INF/services/javax.xml.stream.XMLOutputFactory</code> files in jars available to the JRE.<br cle
 ar="none"> 4. Use the platform default XMLInputFactory,XMLOutputFactory instance.</p><h3 id="BookDataFormatAppendix-HowtosettheXMLencodinginXstreamDataFormat?">How to set the XML encoding in Xstream DataFormat?</h3><p>From Camel 2.2.0, you can set the encoding of XML in Xstream DataFormat by setting the Exchange's property with the key <code>Exchange.CHARSET_NAME</code>, or setting the encoding property on Xstream from DSL or Spring config.</p><plain-text-body>from("activemq:My.Queue").
+  marshal().xstream("UTF-8").
+  to("mqseries:Another.Queue");
+</plain-text-body><p><plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringMarshalListTest.xml}</plain-text-body></p><h3 id="BookDataFormatAppendix-SettingthetypepermissionsofXstreamDataFormat">Setting the type permissions of Xstream DataFormat</h3><p>In Camel, one can always use its own processing step in the route to filter and block certain XML documents to be routed to the XStream's unmarhall step. From Camel 2.16.1, 2.15.5, you can set&#160;<a shape="rect" class="external-link" href="http://x-stream.github.io/security.html" rel="nofollow">XStream's type permissions</a>&#160;to automatically allow or deny the instantiation of certain types.</p><p>The default type permissions setting used by Camel denies all types except for those from java.lang and java.util packages. This setting can be changed by setting System property org.apache.camel.xstream.permissions. Its value is a string of comma-s
 eparated permission terms, each representing a type being allowed or denied, depending on whether the term is prefixed with '+' (note '+' may be omitted) or with '-', respectively.</p><p>Each term may contain a wildcard character '*'. For example, value "-*,java.lang.*,java.util.*" indicates denying all types except for java.lang.* and java.util.* classes. Setting this value to an empty string "" reverts to the default XStream's type permissions handling which denies certain blacklisted classes and allow others.</p><p>The type permissions setting can be extended at an individual XStream DataFormat instance by setting its type permissions property.</p><plain-text-body>    &lt;dataFormats&gt;
+        &lt;xstream id="xstream-default" 
+                 permissions="org.apache.camel.samples.xstream.*"/&gt;
         ...
 
 
-]]></script>
-</div></div>
+</plain-text-body>
 <h2 id="BookDataFormatAppendix-CSV">CSV</h2><p>The CSV <a shape="rect" href="data-format.html">Data Format</a> uses <a shape="rect" class="external-link" href="http://commons.apache.org/proper/commons-csv/">Apache Commons CSV</a> to handle CSV payloads (Comma Separated Values) such as those exported/imported by Excel.</p><p>As of Camel 2.15.0, it now uses the&#160;<a shape="rect" class="external-link" href="http://commons.apache.org/proper/commons-csv/archives/1.1/index.html">Apache Commons CSV 1.1</a> which is based on a completely different set of options.</p><h3 id="BookDataFormatAppendix-AvailableoptionsuntilCamel2.15">Available options until Camel 2.15</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"
 ><p>config</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>CSVConfig</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Can be used to set a custom <code>CSVConfig</code> object.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>strategy</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>CSVStrategy</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Can be used to set a custom <code>CSVStrategy</code>; the default is <code>CSVStrategy.DEFAULT_STRATEGY</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>autogenColumns</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether or not columns are auto-generated in the resulting CSV. The default value is <code>true</code>; subsequent messages use the previously created columns with new fields being added at the end of the line.</p></td></tr><tr><td colspan="1" rowspan="1" class="
 confluenceTd"><p>delimiter</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4:</strong> The column delimiter to use; the default value is "<code>,</code>".</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>skipFirstLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> Whether or not to skip the first line of CSV input when unmarshalling (e.g. if the content has headers on the first line); the default value is <code>false</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">lazyLoad</td><td colspan="1" rowspan="1" class="confluenceTd">boolean</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.12.2:</strong><span><span>&#160;Whether or not to </span></span><span style="line-height: 1.4285715;">Sequential access CSV input through 
 an iterator which could avoid OOM exception when processing huge CSV file; </span><span>the default value is false </span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">useMaps</td><td colspan="1" rowspan="1" class="confluenceTd">boolean</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.13:</strong> Whether to use List&lt;Map&gt; when unmarshalling instead of List&lt;List&gt;.</td></tr></tbody></table></div><h3 id="BookDataFormatAppendix-AvailableoptionsasofCamel2.15">Available options as of Camel 2.15</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Option</th><th colspan="1" rowspan="1" class="confluenceTh">Type</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>format</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>CSVFormat</code></td><td colspan="1" rowspan="1" class="confluen
 ceTd">The reference format to use, it will be updated with the other format options, the default value is <code>CSVFormat.DEFAULT</code></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>commentMarkerDisabled</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>boolean</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Disables the comment marker of the reference format.</p><p>This option is <code>false</code> by default.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>commentMarker</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Character</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Overrides the comment marker of the reference format.</p><p>This option is <code>null</code> by default. When <code>null</code> it keeps the value of the reference format which is <code>null</code> for <code>CSVFormat.DEFAULT</code>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><co
 de>delimiter</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Character</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Overrides the delimiter of the reference format.</p><p>This option is <code>null</code> by defaut. <span>When </span><code>null</code><span> it keeps the value of the reference format which is </span><code>','</code><span> for </span><code>CSVFormat.DEFAULT</code><span>.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>escapeDisabled</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>boolean</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Disables the escape character of the reference format.</p><p>This option is <code>false</code> by default.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>escape</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Character</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Overrides the esc
 ape character of the reference format.</p><p>This option is <code>null</code> by default. <span>When </span><code>null</code><span> it keeps the value of the reference format which is </span><code>null</code><span> for </span><code>CSVFormat.DEFAULT</code><span>.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>headerDisabled</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>boolean</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Disables the header of the reference format.</p><p>This option is <code>false</code> by default.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>header</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>String[]</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Overrides the header of the reference format.</p><p>This option is <code>null</code> by default. <span>When </span><code>null</code><span> it keeps the value of the reference format which 
 is </span><code>null</code><span> for </span><code>CSVFormat.DEFAULT</code><span>.</span></p><p>In the XML DSL, this option is configured using children&#160;<code>&lt;header&gt;</code>&#160;tags:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;csv &gt;
     &lt;header&gt;orderId&lt;/header&gt;
@@ -692,100 +567,39 @@ from(&quot;seda:people&quot;).marshal(df
 &lt;/dependency&gt;
 ]]></script>
 </div></div>
-<h2 id="BookDataFormatAppendix-JSON">JSON</h2><p>JSON is a <a shape="rect" href="data-format.html">Data Format</a> to marshal and unmarshal Java objects to and from <a shape="rect" class="external-link" href="http://www.json.org/" rel="nofollow">JSON</a>.</p><p>For JSON to object marshalling, Camel provides integration with three popular JSON libraries:</p><ul class="alternate"><li>The <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> and <a shape="rect" class="external-link" href="http://jettison.codehaus.org/" rel="nofollow">Jettsion </a></li><li>The <a shape="rect" class="external-link" href="https://github.com/FasterXML/jackson" rel="nofollow">Jackson library</a></li><li><strong>Camel 2.10:</strong> The <a shape="rect" class="external-link" href="http://code.google.com/p/google-gson/" rel="nofollow">GSon library</a></li></ul><p>Every library requires adding the special camel component (see "Dependency..." paragraphs furt
 her down). By default Camel uses the XStream library.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Direct, bi-directional JSON &lt;=&gt; XML conversions</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of Camel 2.10, Camel supports direct, bi-directional JSON &lt;=&gt; XML conversions via the <a shape="rect" href="xmljson.html">camel-xmljson</a> data format, which is documented separately.</p></div></div><h3 id="BookDataFormatAppendix-UsingJSONDataFormatWiththeXStreamLibrary">Using JSON Data Format With the&#160;<code>XStream</code> Library</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Let&#39;s turn Object messages into JSON then send to MQSeries
-from(&quot;activemq:My.Queue&quot;)
+<h2 id="BookDataFormatAppendix-JSON">JSON</h2><p>JSON is a <a shape="rect" href="data-format.html">Data Format</a> to marshal and unmarshal Java objects to and from <a shape="rect" class="external-link" href="http://www.json.org/" rel="nofollow">JSON</a>.</p><p>For JSON to object marshalling, Camel provides integration with three popular JSON libraries:</p><ul class="alternate"><li>The <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> and <a shape="rect" class="external-link" href="http://jettison.codehaus.org/" rel="nofollow">Jettsion </a></li><li>The <a shape="rect" class="external-link" href="https://github.com/FasterXML/jackson" rel="nofollow">Jackson library</a></li><li><strong>Camel 2.10:</strong> The <a shape="rect" class="external-link" href="http://code.google.com/p/google-gson/" rel="nofollow">GSon library</a></li></ul><p>Every library requires adding the special camel component (see "Dependency..." paragraphs furt
 her down). By default Camel uses the XStream library.</p><parameter ac:name="title">Direct, bi-directional JSON &lt;=&gt; XML conversions</parameter><rich-text-body><p>As of Camel 2.10, Camel supports direct, bi-directional JSON &lt;=&gt; XML conversions via the <a shape="rect" href="xmljson.html">camel-xmljson</a> data format, which is documented separately.</p></rich-text-body><h3 id="BookDataFormatAppendix-UsingJSONDataFormatWiththeXStreamLibrary">Using JSON Data Format With the&#160;<code>XStream</code> Library</h3><parameter ac:name="language">java</parameter><plain-text-body>// Let's turn Object messages into JSON then send to MQSeries
+from("activemq:My.Queue")
   .marshal().json()
-  .to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-UsingJSONDataFormatWiththeJacksonLibrary">Using JSON Data Format With the&#160;<code>Jackson</code> Library</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Let&#39;s turn Object messages into JSON then send to MQSeries
-from(&quot;activemq:My.Queue&quot;)
+  .to("mqseries:Another.Queue");
+</plain-text-body><h3 id="BookDataFormatAppendix-UsingJSONDataFormatWiththeJacksonLibrary">Using JSON Data Format With the&#160;<code>Jackson</code> Library</h3><parameter ac:name="language">java</parameter><plain-text-body>// Let's turn Object messages into JSON then send to MQSeries
+from("activemq:My.Queue")
   .marshal().json(JsonLibrary.Jackson)
-  .to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-UsingJSONDataFormatWiththeGSONLibrary">Using JSON Data Format With the GSON Library</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Let&#39;s turn Object messages into JSON then send to MQSeries
-from(&quot;activemq:My.Queue&quot;)
+  .to("mqseries:Another.Queue");
+</plain-text-body><h3 id="BookDataFormatAppendix-UsingJSONDataFormatWiththeGSONLibrary">Using JSON Data Format With the GSON Library</h3><parameter ac:name="language">java</parameter><plain-text-body>// Let's turn Object messages into JSON then send to MQSeries
+from("activemq:My.Queue")
   .marshal().json(JsonLibrary.Gson)
-  .to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><h4 id="BookDataFormatAppendix-UsingJSONinSpringDSL">Using JSON in Spring DSL</h4><p>When using <a shape="rect" href="data-format.html">Data Format</a> in Spring DSL you need to declare the data formats first. This is done in the <strong><code>DataFormats</code></strong> XML tag.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dataFormats&gt;
+  .to("mqseries:Another.Queue");
+</plain-text-body><h4 id="BookDataFormatAppendix-UsingJSONinSpringDSL">Using JSON in Spring DSL</h4><p>When using <a shape="rect" href="data-format.html">Data Format</a> in Spring DSL you need to declare the data formats first. This is done in the <strong><code>DataFormats</code></strong> XML tag.</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dataFormats&gt;
   &lt;!-- 
        Here we define a Json data format with the id jack and that it should use the TestPojo
        as the class type when doing unmarshal.
 
        The unmarshalTypeName is optional, if not provided Camel will use a Map as the type.
   --&gt;
-  &lt;json id=&quot;jack&quot; library=&quot;Jackson&quot; unmarshalTypeName=&quot;org.apache.camel.component.jackson.TestPojo&quot;/&gt;
+  &lt;json id="jack" library="Jackson" unmarshalTypeName="org.apache.camel.component.jackson.TestPojo"/&gt;
 &lt;/dataFormats&gt;
-]]></script>
-</div></div><p>And then you can refer to this id in the route:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;route&gt;
-  &lt;from uri=&quot;direct:back&quot;/&gt;
-  &lt;unmarshal ref=&quot;jack&quot;/&gt;
-  &lt;to uri=&quot;mock:reverse&quot;/&gt;
+</plain-text-body><p>And then you can refer to this id in the route:</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;route&gt;
+  &lt;from uri="direct:back"/&gt;
+  &lt;unmarshal ref="jack"/&gt;
+  &lt;to uri="mock:reverse"/&gt;
 &lt;/route&gt;
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-ExcludingPOJOFieldsFromMarshalling">Excluding POJO Fields From Marshalling</h3><p><strong>As of Camel 2.10</strong><br clear="none"> When marshaling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use <a shape="rect" class="external-link" href="http://wiki.fasterxml.com/JacksonJsonViews" rel="nofollow">JSON views</a> to accomplish this.</p><p>First create one or more marker classes:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-public class Views {
-
-    static class Age { }
-    static class Weight { }
-}
-]]></script>
-</div></div>Second, use the marker classes with the <strong><code>@JsonView</code></strong> annotation to include/exclude certain fields. The annotation also works on getters:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-@JsonView(Views.Age.class)
-private int age = 30;
-
-private int height = 190;
-
-@JsonView(Views.Weight.class)
-private int weight = 70;
-]]></script>
-</div></div>Finally, use the Camel <strong><code>JacksonDataFormat</code></strong> to marshal the above POJO to JSON.<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-from(&quot;direct:inPojoAgeView&quot;).marshal().json(TestPojoView.class, Views.Age.class);
-]]></script>
-</div></div><strong>Note</strong>: the height field is missing in the resulting JSON.<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[{&quot;age&quot;:30, &quot;weight&quot;:70}
-]]></script>
-</div></div><p>The GSON library supports a similar feature through the notion of <a shape="rect" class="external-link" href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/ExclusionStrategy.html" rel="nofollow">ExclusionStrategies</a>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-/**
- * Strategy to exclude {@link ExcludeAge} annotated fields
- */
-protected static class AgeExclusionStrategy implements ExclusionStrategy {
-
-    @Override
-    public boolean shouldSkipField(FieldAttributes f) {
-        return f.getAnnotation(ExcludeAge.class) != null;
-    }
-
-    @Override
-    public boolean shouldSkipClass(Class&lt;?&gt; clazz) {
-        return false;
-    }
-}
-]]></script>
-</div></div>The <strong><code>GsonDataFormat</code></strong> accepts an <strong><code>ExclusionStrategy</code></strong> in its constructor:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-GsonDataFormat ageExclusionFormat = new GsonDataFormat(TestPojoExclusion.class);
-ageExclusionFormat.setExclusionStrategies(Arrays.&lt;ExclusionStrategy&gt;asList(new AgeExclusionStrategy()));
-from(&quot;direct:inPojoExcludeAge&quot;).marshal(ageExclusionFormat);
-]]></script>
-</div></div>The line above will exclude fields annotated with <strong><code>@ExcludeAge</code></strong> when marshaling to JSON.<h3 id="BookDataFormatAppendix-ConfiguringFieldNamingPolicy">Configuring Field Naming Policy</h3><p><strong>Available as of Camel 2.11</strong></p><p>The GSON library supports specifying policies and strategies for mapping from JSON to POJO fields. A common naming convention is to map JSON fields using lower case with underscores.</p><p>We may have this JSON string</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[{
-  &quot;id&quot; : 123,
-  &quot;first_name&quot; : &quot;Donald&quot;
-  &quot;last_name&quot; : &quot;Duck&quot;
+</plain-text-body><h3 id="BookDataFormatAppendix-ExcludingPOJOFieldsFromMarshalling">Excluding POJO Fields From Marshalling</h3><p><strong>As of Camel 2.10</strong><br clear="none"> When marshaling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use <a shape="rect" class="external-link" href="http://wiki.fasterxml.com/JacksonJsonViews" rel="nofollow">JSON views</a> to accomplish this.</p><p>First create one or more marker classes:<plain-text-body>{snippet:id=marker|lang=java|url=camel/trunk/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/Views.java}</plain-text-body>Second, use the marker classes with the <strong><code>@JsonView</code></strong> annotation to include/exclude certain fields. The annotation also works on getters:<plain-text-body>{snippet:id=jsonview|lang=java|url=camel/trunk/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/TestPojoView.java}</plain-text-body>Finally, u
 se the Camel <strong><code>JacksonDataFormat</code></strong> to marshal the above POJO to JSON.<plain-text-body>{snippet:id=format|lang=java|url=camel/trunk/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalViewTest.java}</plain-text-body><strong>Note</strong>: the height field is missing in the resulting JSON.</p><plain-text-body>{"age":30, "weight":70}
+</plain-text-body><p>The GSON library supports a similar feature through the notion of <a shape="rect" class="external-link" href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/ExclusionStrategy.html" rel="nofollow">ExclusionStrategies</a>:<plain-text-body>{snippet:id=strategy|lang=java|url=camel/trunk/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonMarshalExclusionTest.java}</plain-text-body>The <strong><code>GsonDataFormat</code></strong> accepts an <strong><code>ExclusionStrategy</code></strong> in its constructor:<plain-text-body>{snippet:id=format|lang=java|url=camel/trunk/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonMarshalExclusionTest.java}</plain-text-body>The line above will exclude fields annotated with <strong><code>@ExcludeAge</code></strong> when marshaling to JSON.</p><h3 id="BookDataFormatAppendix-ConfiguringFieldNamingPolicy">Configuring Field Naming Policy</h3><p><strong>Available a
 s of Camel 2.11</strong></p><p>The GSON library supports specifying policies and strategies for mapping from JSON to POJO fields. A common naming convention is to map JSON fields using lower case with underscores.</p><p>We may have this JSON string</p><plain-text-body>{
+  "id" : 123,
+  "first_name" : "Donald"
+  "last_name" : "Duck"
 }
-]]></script>
-</div></div><p>Which we want to map to a POJO that has getter/setters as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>PersonPojo.java</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[public class PersonPojo {
+</plain-text-body><p>Which we want to map to a POJO that has getter/setters as:</p><parameter ac:name="language">java</parameter><parameter ac:name="java:title">PersonPojo.java</parameter><parameter ac:name="title">PersonPojo.java</parameter><plain-text-body>public class PersonPojo {
 
     private int id;
     private String firstName;
@@ -815,153 +629,102 @@ from(&quot;direct:inPojoExcludeAge&quot;
         this.lastName = lastName;
     }
 }
-]]></script>
-</div></div><p>Then we can configure the <strong><code>org.apache.camel.component.gson.GsonDataFormat</code></strong> in a Spring XML files as shown below. Notice we use <strong><code>fieldNamingPolicy</code></strong> property to set the field mapping. This property is an enum from GSon <strong><code>com.google.gson.FieldNamingPolicy</code></strong> which has a number of predefined mappings.</p><p>If you need full control you can use the property <strong><code>FieldNamingStrategy</code></strong> and implement a custom <strong><code>com.google.gson.FieldNamingStrategy</code></strong> where you can control the mapping.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Configuring GsonDataFromat in Spring XML file</b></div><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;!-- define the gson data format, where we configure the data format using the properties --&gt;
-&lt;bean id=&quot;gson&quot; class=&quot;org.apache.camel.component.gson.GsonDataFormat&quot;&gt;
+</plain-text-body><p>Then we can configure the <strong><code>org.apache.camel.component.gson.GsonDataFormat</code></strong> in a Spring XML files as shown below. Notice we use <strong><code>fieldNamingPolicy</code></strong> property to set the field mapping. This property is an enum from GSon <strong><code>com.google.gson.FieldNamingPolicy</code></strong> which has a number of predefined mappings.</p><p>If you need full control you can use the property <strong><code>FieldNamingStrategy</code></strong> and implement a custom <strong><code>com.google.gson.FieldNamingStrategy</code></strong> where you can control the mapping.</p><parameter ac:name="xml:title">Configuring GsonDataFormat in Spring XML file</parameter><parameter ac:name="language">xml</parameter><parameter ac:name="title">Configuring GsonDataFromat in Spring XML file</parameter><plain-text-body>&lt;!-- define the gson data format, where we configure the data format using the properties --&gt;
+&lt;bean id="gson" class="org.apache.camel.component.gson.GsonDataFormat"&gt;
 
   &lt;!-- we want to unmarshal to person pojo --&gt;
-  &lt;property name=&quot;unmarshalType&quot; value=&quot;org.apache.camel.component.gson.PersonPojo&quot;/&gt;
+  &lt;property name="unmarshalType" value="org.apache.camel.component.gson.PersonPojo"/&gt;
 
   &lt;!-- we want to map fields to use lower case and underscores --&gt;
-  &lt;property name=&quot;fieldNamingPolicy&quot; value=&quot;LOWER_CASE_WITH_UNDERSCORES&quot;/&gt;
+  &lt;property name="fieldNamingPolicy" value="LOWER_CASE_WITH_UNDERSCORES"/&gt;
 &lt;/bean&gt;
-]]></script>
-</div></div><p>And use it in Camel routes by referring to its bean id as shown:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Using gson from Camel Routes</b></div><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
+</plain-text-body><p>And use it in Camel routes by referring to its bean id as shown:</p><parameter ac:name="xml:title">Using gson from Camel routes</parameter><parameter ac:name="language">xml</parameter><parameter ac:name="title">Using gson from Camel Routes</parameter><plain-text-body>&lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
   &lt;route&gt;
-    &lt;from uri=&quot;direct:inPojo&quot;/&gt;
-    &lt;marshal ref=&quot;gson&quot;/&gt;
+    &lt;from uri="direct:inPojo"/&gt;
+    &lt;marshal ref="gson"/&gt;
   &lt;/route&gt;
 
   &lt;route&gt;
-    &lt;from uri=&quot;direct:backPojo&quot;/&gt;
-    &lt;unmarshal ref=&quot;gson&quot;/&gt;
+    &lt;from uri="direct:backPojo"/&gt;
+    &lt;unmarshal ref="gson"/&gt;
   &lt;/route&gt;
 &lt;/camelContext&gt;
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-Include/ExcludeFieldsUsingthejsonViewAttributeWithJacksonDataFormat">Include/Exclude Fields Using the <strong><code>jsonView</code></strong> Attribute With <code>JacksonDataFormat</code></h3><p><strong>Available as of Camel 2.12</strong></p><p>As an example of using this attribute you can instead of:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class);
+</plain-text-body><h3 id="BookDataFormatAppendix-Include/ExcludeFieldsUsingthejsonViewAttributeWithJacksonDataFormat">Include/Exclude Fields Using the <strong><code>jsonView</code></strong> Attribute With <code>JacksonDataFormat</code></h3><p><strong>Available as of Camel 2.12</strong></p><p>As an example of using this attribute you can instead of:</p><parameter ac:name="language">java</parameter><plain-text-body>JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class);
 
-from(&quot;direct:inPojoAgeView&quot;)
+from("direct:inPojoAgeView")
   .marshal(ageViewFormat);
-]]></script>
-</div></div><p>Directly specify your <a shape="rect" class="external-link" href="http://wiki.fasterxml.com/JacksonJsonViews" rel="nofollow">JSON view</a> inside the Java DSL as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from(&quot;direct:inPojoAgeView&quot;)
+</plain-text-body><p>Directly specify your <a shape="rect" class="external-link" href="http://wiki.fasterxml.com/JacksonJsonViews" rel="nofollow">JSON view</a> inside the Java DSL as:</p><parameter ac:name="language">java</parameter><plain-text-body>from("direct:inPojoAgeView")
   .marshal().json(TestPojoView.class, Views.Age.class);
-]]></script>
-</div></div><p>And the same in XML DSL:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;from uri=&quot;direct:inPojoAgeView&quot;/&gt;
+</plain-text-body><p>And the same in XML DSL:</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;from uri="direct:inPojoAgeView"/&gt;
   &lt;marshal&gt;
-    &lt;json library=&quot;Jackson&quot; unmarshalTypeName=&quot;org.apache.camel.component.jackson.TestPojoView&quot; jsonView=&quot;org.apache.camel.component.jackson.Views$Age&quot;/&gt;
+    &lt;json library="Jackson" unmarshalTypeName="org.apache.camel.component.jackson.TestPojoView" jsonView="org.apache.camel.component.jackson.Views$Age"/&gt;
   &lt;/marshal&gt;
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-SettingSerializationIncludeOptionforJacksonMarshal">Setting Serialization Include Option for Jackson Marshal</h3><p><strong>Available as of Camel 2.13.3/2.14</strong></p><p>If you want to marshal a POJO to JSON, and the&#160;POJO has some fields with null values. And you want to skip these null values, then you need to set either an annotation on the POJO,&#160;</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[@JsonInclude(Include.NON_NULL)
+</plain-text-body><h3 id="BookDataFormatAppendix-SettingSerializationIncludeOptionforJacksonMarshal">Setting Serialization Include Option for Jackson Marshal</h3><p><strong>Available as of Camel 2.13.3/2.14</strong></p><p>If you want to marshal a POJO to JSON, and the&#160;POJO has some fields with null values. And you want to skip these null values, then you need to set either an annotation on the POJO,&#160;</p><parameter ac:name="language">java</parameter><plain-text-body>@JsonInclude(Include.NON_NULL)
 public class MyPojo {
    // ...
-}]]></script>
-</div></div><p>But this requires you to include that annotation in your&#160;POJO source code. You can also configure the Camel&#160;<strong><code>JsonDataFormat</code></strong> to set the include option, as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[JacksonDataFormat format = new JacksonDataFormat();
-format.setInclude(&quot;NON_NULL&quot;);]]></script>
-</div></div><p>Or from XML DSL you configure this as</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dataFormats&gt;
-  &lt;json id=&quot;json&quot; library=&quot;Jackson&quot; include=&quot;NON_NULL&quot;/&gt;
-&lt;/dataFormats&gt;]]></script>
-</div></div><h3 id="BookDataFormatAppendix-UnmarshalingfromJSONtoPOJOwithDynamicClassName">Unmarshaling from JSON to POJO with Dynamic Class Name</h3><p><strong>Available as of Camel 2.14</strong></p><p>If you use Jackson to unmarshal JSON to POJO, then you can now specify a header in the message that indicate which class name to unmarshal to.<span style="line-height: 1.4285715;"> The header has key </span><strong><code style="line-height: 1.4285715;">CamelJacksonUnmarshalType</code></strong><span style="line-height: 1.4285715;">&#160;if that header is present in the message, then Jackson will use that as FQN for the POJO class to unmarshal the JSON payload as. Notice that behavior is enabled out of the box from <strong>Camel 2.14</strong>.&#160;</span></p><p><span style="line-height: 1.4285715;">&#160;</span><span style="line-height: 1.4285715;">For JMS end users there is the&#160;<strong><code>JMSType</code></strong> header from the JMS spec that indicates that also. To enable sup
 port for&#160;<span><strong><code>JMSType</code></strong></span> you would need to turn that on, on the Jackson data format as shown:</span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[JacksonDataFormat format = new JacksonDataFormat();
-format.setAllowJmsType(true);]]></script>
-</div></div><p>Or from XML DSL you configure this as</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dataFormats&gt;
-  &lt;json id=&quot;json&quot; library=&quot;Jackson&quot; allowJmsType=&quot;true&quot;/&gt;
-&lt;/dataFormats&gt;]]></script>
-</div></div><h3 id="BookDataFormatAppendix-UnmarshalingFromJSONtoList&lt;Map&gt;orList&lt;pojo&gt;">Unmarshaling From JSON to&#160;<code>List&lt;Map&gt;</code> or&#160;<code>List&lt;pojo&gt;</code></h3><p><strong>Available as of Camel 2.14</strong></p><p>If you are using Jackson to unmarshal JSON to a list of map/POJO, you can now specify this by setting&#160;<strong><code>useList="true"</code></strong> or use the&#160;<strong><code>org.apache.camel.component.jackson.ListJacksonDataFormat</code></strong>.</p><p>For example, with Java you can do as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[JacksonDataFormat format = new ListJacksonDataFormat();
+}</plain-text-body><p>But this requires you to include that annotation in your&#160;POJO source code. You can also configure the Camel&#160;<strong><code>JsonDataFormat</code></strong> to set the include option, as shown below:</p><parameter ac:name="language">java</parameter><plain-text-body>JacksonDataFormat format = new JacksonDataFormat();
+format.setInclude("NON_NULL");</plain-text-body><p>Or from XML DSL you configure this as</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dataFormats&gt;
+  &lt;json id="json" library="Jackson" include="NON_NULL"/&gt;
+&lt;/dataFormats&gt;</plain-text-body><h3 id="BookDataFormatAppendix-UnmarshalingfromJSONtoPOJOwithDynamicClassName">Unmarshaling from JSON to POJO with Dynamic Class Name</h3><p><strong>Available as of Camel 2.14</strong></p><p>If you use Jackson to unmarshal JSON to POJO, then you can now specify a header in the message that indicate which class name to unmarshal to.<span style="line-height: 1.4285715;"> The header has key </span><strong><code style="line-height: 1.4285715;">CamelJacksonUnmarshalType</code></strong><span style="line-height: 1.4285715;">&#160;if that header is present in the message, then Jackson will use that as FQN for the POJO class to unmarshal the JSON payload as. Notice that behavior is enabled out of the box from <strong>Camel 2.14</strong>.&#160;</span></p><p><span style="line-height: 1.4285715;">&#160;</span><span style="line-height: 1.4285715;">For JMS end users there is the&#160;<strong><code>JMSType</code></strong> header from the JMS spec that indicate
 s that also. To enable support for&#160;<span><strong><code>JMSType</code></strong></span> you would need to turn that on, on the Jackson data format as shown:</span></p><parameter ac:name="language">java</parameter><plain-text-body>JacksonDataFormat format = new JacksonDataFormat();
+format.setAllowJmsType(true);</plain-text-body><p>Or from XML DSL you configure this as</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dataFormats&gt;
+  &lt;json id="json" library="Jackson" allowJmsType="true"/&gt;
+&lt;/dataFormats&gt;</plain-text-body><h3 id="BookDataFormatAppendix-UnmarshalingFromJSONtoList&lt;Map&gt;orList&lt;pojo&gt;">Unmarshaling From JSON to&#160;<code>List&lt;Map&gt;</code> or&#160;<code>List&lt;pojo&gt;</code></h3><p><strong>Available as of Camel 2.14</strong></p><p>If you are using Jackson to unmarshal JSON to a list of map/POJO, you can now specify this by setting&#160;<strong><code>useList="true"</code></strong> or use the&#160;<strong><code>org.apache.camel.component.jackson.ListJacksonDataFormat</code></strong>.</p><p>For example, with Java you can do as shown below:</p><parameter ac:name="language">java</parameter><plain-text-body>JacksonDataFormat format = new ListJacksonDataFormat();
 // or
 JacksonDataFormat format = new JacksonDataFormat();
 format.useList();
 
 // and you can specify the pojo class type also
-format.setUnmarshalType(MyPojo.class);]]></script>
-</div></div><p>And if you use XML DSL then you configure to use list using <code>useList</code> attribute as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dataFormats&gt;
-  &lt;json id=&quot;json&quot; library=&quot;Jackson&quot; useList=&quot;true&quot;/&gt;
-&lt;/dataFormats&gt;]]></script>
-</div></div><p>And you can specify the pojo type also</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dataFormats&gt;
-  &lt;json id=&quot;json&quot; library=&quot;Jackson&quot; useList=&quot;true&quot; unmarshalTypeName=&quot;com.foo.MyPojo&quot;/&gt;
-&lt;/dataFormats&gt;]]></script>
-</div></div><h3 id="BookDataFormatAppendix-UsingCustomJackson'sObjectMapper">Using Custom Jackson's <code>ObjectMapper</code></h3><p><strong>Available from Camel 2.17</strong></p><p>You can use custom Jackson&#160;<strong><code>ObjectMapper</code></strong> instance, can be configured as shown below.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dataFormats&gt;
-  &lt;json id=&quot;json&quot; library=&quot;Jackson&quot; objectMapper=&quot;myMapper&quot;/&gt;
-&lt;/dataFormats&gt;]]></script>
-</div></div><p>Where&#160;<strong><code>myMapper</code></strong> is the id of the custom instance that Camel will lookup in the&#160;<a shape="rect" href="registry.html">Registry.</a></p><h3 id="BookDataFormatAppendix-UsingCustomJacksonModules">Using Custom Jackson Modules</h3><p><strong>Available as of Camel 2.15</strong></p><p>You can use custom Jackson modules by specifying the class names of those using the&#160;<strong><code>moduleClassNames</code></strong> option as shown below.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dataFormats&gt;
-  &lt;json id=&quot;json&quot; library=&quot;Jackson&quot; useList=&quot;true&quot; unmarshalTypeName=&quot;com.foo.MyPojo&quot; moduleClassNames=&quot;com.foo.MyModule,com.foo.MyOtherModule&quot;/&gt;
-&lt;/dataFormats&gt;]]></script>
-</div></div><p>When using&#160;<strong><code>moduleClassNames</code></strong> then the custom Jackson modules are not configured, by created using default constructor and used as-is. If a custom module needs any custom configuration, then an instance of the module can be created and configured, and then use&#160;<strong><code>modulesRefs</code></strong> to refer to the module as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;myJacksonModule&quot; class=&quot;com.foo.MyModule&quot;&gt;
+format.setUnmarshalType(MyPojo.class);</plain-text-body><p>And if you use XML DSL then you configure to use list using <code>useList</code> attribute as shown below:</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dataFormats&gt;
+  &lt;json id="json" library="Jackson" useList="true"/&gt;
+&lt;/dataFormats&gt;</plain-text-body><p>And you can specify the pojo type also</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dataFormats&gt;
+  &lt;json id="json" library="Jackson" useList="true" unmarshalTypeName="com.foo.MyPojo"/&gt;
+&lt;/dataFormats&gt;</plain-text-body><h3 id="BookDataFormatAppendix-UsingCustomJackson'sObjectMapper">Using Custom Jackson's <code>ObjectMapper</code></h3><p><strong>Available from Camel 2.17</strong></p><p>You can use custom Jackson&#160;<strong><code>ObjectMapper</code></strong> instance, can be configured as shown below.</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dataFormats&gt;
+  &lt;json id="json" library="Jackson" objectMapper="myMapper"/&gt;
+&lt;/dataFormats&gt;</plain-text-body><p>Where&#160;<strong><code>myMapper</code></strong> is the id of the custom instance that Camel will lookup in the&#160;<a shape="rect" href="registry.html">Registry.</a></p><h3 id="BookDataFormatAppendix-UsingCustomJacksonModules">Using Custom Jackson Modules</h3><p><strong>Available as of Camel 2.15</strong></p><p>You can use custom Jackson modules by specifying the class names of those using the&#160;<strong><code>moduleClassNames</code></strong> option as shown below.</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dataFormats&gt;
+  &lt;json id="json" library="Jackson" useList="true" unmarshalTypeName="com.foo.MyPojo" moduleClassNames="com.foo.MyModule,com.foo.MyOtherModule"/&gt;
+&lt;/dataFormats&gt;</plain-text-body><p>When using&#160;<strong><code>moduleClassNames</code></strong> then the custom Jackson modules are not configured, by created using default constructor and used as-is. If a custom module needs any custom configuration, then an instance of the module can be created and configured, and then use&#160;<strong><code>modulesRefs</code></strong> to refer to the module as shown below:</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;bean id="myJacksonModule" class="com.foo.MyModule"&gt;
   ... // configure the module as you want
 &lt;/bean&gt;
- 
+&#160;
 &lt;dataFormats&gt;
-  &lt;json id=&quot;json&quot; library=&quot;Jackson&quot; useList=&quot;true&quot; unmarshalTypeName=&quot;com.foo.MyPojo&quot; moduleRefs=&quot;myJacksonModule&quot;/&gt;
-&lt;/dataFormats&gt;]]></script>

[... 380 lines stripped ...]