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 Sat Jul 11 
15:19:53 2015
@@ -108,13 +108,13 @@
 <p>For example</p>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-DataFormat jaxb = new JaxbDataFormat("com.acme.model");
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+DataFormat jaxb = new JaxbDataFormat(&quot;com.acme.model&quot;);
 
-from("activemq:My.Queue").
+from(&quot;activemq:My.Queue&quot;).
   unmarshal(jaxb).
-  to("mqseries:Another.Queue");
-</pre>
+  to(&quot;mqseries:Another.Queue&quot;);
+]]></script>
 </div></div>
 
 <p>The above uses a named DataFormat of <em>jaxb</em> which is configured with 
a number of Java package names. 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.</p>
@@ -122,11 +122,11 @@ from("activemq:My.Queue").
 <p>You can also use the DSL itself to define the data format as you use it. 
For example the following uses Java serialization to unmarshal a binary file 
then send it as an ObjectMessage to <a shape="rect" 
href="activemq.html">ActiveMQ</a></p>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-from("file://foo/bar").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+from(&quot;file://foo/bar&quot;).
   unmarshal().serialization().
-  to("activemq:Some.Queue");
-</pre>
+  to(&quot;activemq:Some.Queue&quot;);
+]]></script>
 </div></div>
 
 <h3 id="BookDataFormatAppendix-Marshalling">Marshalling</h3>
@@ -136,12 +136,12 @@ from("file://foo/bar").
 <p>The following example unmarshals via serialization then marshals using a 
named JAXB data format to perform a kind of <a shape="rect" 
href="message-translator.html">Message Translator</a></p>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-from("file://foo/bar").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+from(&quot;file://foo/bar&quot;).
   unmarshal().serialization(). 
-  marshal("jaxb").
-  to("activemq:Some.Queue");
-</pre>
+  marshal(&quot;jaxb&quot;).
+  to(&quot;activemq:Some.Queue&quot;);
+]]></script>
 </div></div>
 
 
@@ -174,12 +174,12 @@ from("file://foo/bar").
 <p>You can also define reusable data formats as Spring beans </p>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-&lt;bean id="myJaxb" 
class="org.apache.camel.model.dataformat.JaxbDataFormat"&gt;
-  &lt;property name="prettyPrint" value="true"/&gt;
-  &lt;property name="contextPath" value="org.apache.camel.example"/&gt;
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+&lt;bean id=&quot;myJaxb&quot; 
class=&quot;org.apache.camel.model.dataformat.JaxbDataFormat&quot;&gt;
+  &lt;property name=&quot;prettyPrint&quot; value=&quot;true&quot;/&gt;
+  &lt;property name=&quot;contextPath&quot; 
value=&quot;org.apache.camel.example&quot;/&gt;
 &lt;/bean&gt;  
-</pre>
+]]></script>
 </div></div>
 
 <h2 id="BookDataFormatAppendix-Serialization">Serialization</h2>
@@ -188,28 +188,28 @@ from("file://foo/bar").
  For example the following uses Java serialization to unmarshal a binary file 
then send it as an ObjectMessage to <a shape="rect" 
href="activemq.html">ActiveMQ</a></p>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-from("file://foo/bar").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+from(&quot;file://foo/bar&quot;).
   unmarshal().serialization().
-  to("activemq:Some.Queue");
-</pre>
+  to(&quot;activemq:Some.Queue&quot;);
+]]></script>
 </div></div>
 
 <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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">DataFormat jaxb = new JaxbDataFormat("com.acme.model");
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[DataFormat jaxb = new 
JaxbDataFormat(&quot;com.acme.model&quot;);
 
-from("activemq:My.Queue").
+from(&quot;activemq:My.Queue&quot;).
   unmarshal(jaxb).
-  to("mqseries:Another.Queue");
-</pre>
+  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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("activemq:My.Queue").
-  unmarshal("myJaxbDataType").
-  to("mqseries:Another.Queue");
-</pre>
+<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;
@@ -266,13 +266,13 @@ from("activemq:My.Queue").
 &lt;/camelContext&gt;
 ]]></script>
 </div></div><p>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, Jaxb
 DataFormat 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></tab
 le></div><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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">   JaxbDataFormat customWriterFormat = new 
JaxbDataFormat("org.apache.camel.foo.bar");
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[   JaxbDataFormat customWriterFormat = new 
JaxbDataFormat(&quot;org.apache.camel.foo.bar&quot;);
   customWriterFormat.setXmlStreamWriterWrapper(new TestXmlStreamWriter());
-</pre>
+]]></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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;bean id="testXmlStreamWriterWrapper" 
class="org.apache.camel.jaxb.TestXmlStreamWriter"/&gt;
-&lt;jaxb filterNonXmlChars="true"  contextPath="org.apache.camel.foo.bar" 
xmlStreamWriterWrapper="#testXmlStreamWriterWrapper" /&gt;
-</pre>
+<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;
@@ -286,58 +286,58 @@ from("activemq:My.Queue").
 &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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">  &lt;util:map id="myMap"&gt;
-    &lt;entry key="http://www.w3.org/2003/05/soap-envelope"; value="soap"/&gt;
+<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;
     &lt;!-- we dont want any prefix for our namespace --&gt;
-    &lt;entry key="http://www.mycompany.com/foo/2"; value=""/&gt;
+    &lt;entry key=&quot;http://www.mycompany.com/foo/2&quot; 
value=&quot;&quot;/&gt;
   &lt;/util:map&gt;
-</pre>
+]]></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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">  &lt;marshal&gt;
-    &lt;soapjaxb version="1.2" contextPath="com.mycompany.foo" 
namespacePrefixRef="myMap"/&gt;
+<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;
   &lt;/marshal&gt;
-</pre>
+]]></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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new 
JaxbDataFormat();
 jaxbDataFormat.setContextPath(Person.class.getPackage().getName());
-jaxbDataFormat.setSchema("classpath:person.xsd,classpath:address.xsd");
-</pre>
+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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;marshal&gt;
-    &lt;jaxb id="jaxb" schema="classpath:person.xsd,classpath:address.xsd"/&gt;
+<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;
 &lt;/marshal&gt;
-</pre>
+]]></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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new 
JaxbDataFormat();
 jaxbDataFormat.setSchemaFactory(thradSafeSchemaFactory);
-</pre>
+]]></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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new 
JaxbDataFormat();
 jaxbDataFormat.setContextPath(Person.class.getPackage().getName());
-jaxbDataFormat.setSchemaLocation("schema/person.xsd");
-</pre>
+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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;marshal&gt;
-    &lt;jaxb id="jaxb" schemaLocation="schema/person.xsd"/&gt;
-&lt;/marshal&gt;</pre>
+<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><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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">&lt;dependency&gt;
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&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;
-</pre>
+]]></script>
 </div></div>
 <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>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-from("activemq:My.Queue").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+from(&quot;activemq:My.Queue&quot;).
   unmarshal().xmlBeans().
-  to("mqseries:Another.Queue");
-</pre>
+  to(&quot;mqseries:Another.Queue&quot;);
+]]></script>
 </div></div>
 
 <h3 id="BookDataFormatAppendix-Dependencies.2">Dependencies</h3>
@@ -347,45 +347,45 @@ from("activemq:My.Queue").
 <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">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-xmlbeans&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;
-</pre>
+]]></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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;dependency&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&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;
-</pre>
+]]></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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">// lets turn Object messages into XML then send to 
MQSeries
-from("activemq:My.Queue").
+<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;).
   marshal().xstream().
-  to("mqseries:Another.Queue");
-</pre>
+  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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">XStream xStream = new XStream();
-xStream.aliasField("money", PurchaseOrder.class, "cash");
+<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;);
 // new Added setModel option since Camel 2.14
-xStream.setModel("NO_REFERENCES");
+xStream.setModel(&quot;NO_REFERENCES&quot;);
 ...
 
-from("direct:marshal").
+from(&quot;direct:marshal&quot;).
   marshal(new XStreamDataFormat(xStream)).
-  to("mock:marshaled");
-</pre>
+  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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("activemq:My.Queue").
-  marshal().xstream("UTF-8").
-  to("mqseries:Another.Queue");
-</pre>
+<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><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;
@@ -412,177 +412,177 @@ from("direct:marshal").
 ]]></script>
 </div></div>
 <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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;csv &gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;csv &gt;
     &lt;header&gt;orderId&lt;/header&gt;
     &lt;header&gt;amount&lt;/header&gt;
-&lt;/csv&gt;</pre>
+&lt;/csv&gt;]]></script>
 </div></div></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>allowMissingColumnNames</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>Boolean</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Overrides the missing column names behavior 
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>false</code><span> for 
</span><code>CSVFormat.DEFAULT</code><span>.</span></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><code>ignoreEmptyLines</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>Boolean</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Overrides the empty line behavior of the 
reference format.</p><p><span>This option is </span><code>null</code><span> by 
default. <span>When </span><code>null</code><span> it keeps the value of the 
reference format which is </sp
 an><code>true</code><span> for 
</span><code>CSVFormat.DEFAULT</code><span>.</span></span></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><code>ignoreSurroundingSpaces</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>Boolean</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Overrides the surrounding spaces behavior 
of the reference format.</p><p><span>This option is 
</span><code>null</code><span> by default. <span>When 
</span><code>null</code><span> it keeps the value of the reference format which 
is </span><code>false</code><span> for 
</span><code>CSVFormat.DEFAULT</code><span>.</span></span></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><code>nullStringDisabled</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>boolean</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Disables the null string representation 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>nullString</code></td><td colspan="1" rowspan="1" 
class="confluenceTd"><code>String</code></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Overrides the null string representation of the 
reference format.</p><p><span>This option is </span><code>null</code><span> 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></span></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><code>quoteDisabled</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><code>boolean</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Disables the quote of the 
reference format.</p><p><span>This option is </span><code>false</code><span> by 
default.</span></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>quote</code></td><td colspan="1" rowspan
 ="1" class="confluenceTd"><code>Character</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Overrides the quote symbol of the reference 
format.</p><p><span>This option is </span><code>null</code><span> by default. 
<span>When </span><code>null</code><span> it keeps the value of the reference 
format which is </span><code>'"'</code><span> (double quote) for 
</span><code>CSVFormat.DEFAULT</code><span>.</span></span></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><code>quoteMode</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><code>QuoteMode</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Overrides the quote mode of the 
reference format.</p><p><span>This option is </span><code>null</code><span> 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></span></p></td></tr><tr><td 
colspan="1" rowspa
 n="1" class="confluenceTd"><code>recordSeparatorDisabled</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><code>boolean</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Disables the record separator 
of the reference format.</p><p><span>This option is 
</span><code>false</code><span> by default.</span></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><code>recordSeparator</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>String</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Overrides the record separator of the 
reference format.</p><p><span>This option is </span><code>null</code><span> by 
default. <span>When </span><code>null</code><span> it keeps the value of the 
reference format which is </span><code>\r\n</code><span> (CRLF) for 
</span><code>CSVFormat.DEFAULT</code><span>.</span></span></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><code>skipHeaderRecord</code></td><td colspan="1" rowspan="
 1" class="confluenceTd"><code>Boolean</code></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Overrides the header record behavior of the reference 
format.</p><p><span>This option is </span><code>null</code><span> by default. 
<span>When </span><code>null</code><span> it keeps the value of the reference 
format which is </span><code>false</code><span> for 
</span><code>CSVFormat.DEFAULT</code><span>.</span></span></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><code>lazyLoad</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><code>boolean</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Whether the unmarshalling 
should produce an iterator that reads the lines on the fly or if all the lines 
must be read at one.</p><p>This option is&#160;<code>false</code>&#160;by 
default.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>useMaps</code></td><td colspan="1" rowspan="1" 
class="confluenceTd"><code>boolean</code></td><td 
 colspan="1" rowspan="1" class="confluenceTd"><p>Whether the unmarshalling 
should produce maps for the lines values instead of lists. It requires to have 
header (either defined or collected).</p><p>This options 
is&#160;<code>false</code>&#160;by default.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><code>recordConverter</code></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><code>CsvRecordConverter</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Sets the record converter to use. If 
defines the <code>useMaps</code> options is disabled.</p><p><span>This option 
is </span><code>null</code><span> by 
default.</span></p></td></tr></tbody></table></div><h3 
id="BookDataFormatAppendix-MarshallingaMaptoCSV">Marshalling a Map to 
CSV</h3><p>The component allows you to marshal a Java Map (or any other message 
type that can be <a shape="rect" href="type-converter.html">converted</a> in a 
Map) into a CSV payload.</p><div class="table-wrap"><table class="confl
 uenceTable"><tbody><tr><td colspan="1" rowspan="1" 
class="confluenceTd">Considering the following body</td><td colspan="1" 
rowspan="1" class="confluenceTd"><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">Map&lt;String, Object&gt; body = new 
LinkedHashMap&lt;&gt;();
-body.put("foo", "abc");
-body.put("bar", 123);</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[Map&lt;String, Object&gt; body = new 
LinkedHashMap&lt;&gt;();
+body.put(&quot;foo&quot;, &quot;abc&quot;);
+body.put(&quot;bar&quot;, 123);]]></script>
 </div></div></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">and 
this Java route definition</td><td colspan="1" rowspan="1" 
class="confluenceTd"><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("direct:start")
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:start&quot;)
     .marshal().csv()
-    .to("mock:result");</pre>
+    .to(&quot;mock:result&quot;);]]></script>
 </div></div></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">or 
this XML route definition</td><td colspan="1" rowspan="1" 
class="confluenceTd"><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
-    &lt;from uri="direct:start" /&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+    &lt;from uri=&quot;direct:start&quot; /&gt;
     &lt;marshal&gt;
         &lt;csv /&gt;
     &lt;/marshal&gt;
-    &lt;to uri="mock:result" /&gt;
-&lt;/route&gt;</pre>
+    &lt;to uri=&quot;mock:result&quot; /&gt;
+&lt;/route&gt;]]></script>
 </div></div></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">then it will produce</td><td colspan="1" rowspan="1" 
class="confluenceTd"><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: text; gutter: false; theme: Default" 
style="font-size:12px;">abc,123</pre>
+<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[abc,123]]></script>
 </div></div></td></tr></tbody></table></div><h3 
id="BookDataFormatAppendix-UnmarshallingaCSVmessageintoaJavaList"><span 
style="font-size: 16.0px;line-height: 1.5625;">Unmarshalling a CSV message into 
a Java List</span></h3><p>Unmarshalling will transform a CSV messsage into a 
Java List with CSV file lines (containing another List with all the field 
values).</p><p><span style="line-height: 1.4285715;">An example: we have a CSV 
file with names of persons, their IQ and their current activity.</span></p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: text; gutter: false; theme: Default" 
style="font-size:12px;">Jack Dalton, 115, mad at Averell
+<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[Jack Dalton, 115, mad at Averell
 Joe Dalton, 105, calming Joe
 William Dalton, 105, keeping Joe from killing Averell
 Averell Dalton, 80, playing with Rantanplan
-Lucky Luke, 120, capturing the Daltons</pre>
+Lucky Luke, 120, capturing the Daltons]]></script>
 </div></div><p>We can now use the CSV component to unmarshal this 
file:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("file:src/test/resources/?fileName=daltons.csv&amp;noop=true")
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;file:src/test/resources/?fileName=daltons.csv&amp;noop=true&quot;)
     .unmarshal().csv()
-    .to("mock:daltons");</pre>
+    .to(&quot;mock:daltons&quot;);]]></script>
 </div></div><p>The resulting message will contain a 
<code>List&lt;List&lt;String&gt;&gt;</code> like...</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">List&lt;List&lt;String&gt;&gt; data = 
(List&lt;List&lt;String&gt;&gt;) exchange.getIn().getBody();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[List&lt;List&lt;String&gt;&gt; data = 
(List&lt;List&lt;String&gt;&gt;) exchange.getIn().getBody();
 for (List&lt;String&gt; line : data) {
-    LOG.debug(String.format("%s has an IQ of %s and is currently %s", 
line.get(0), line.get(1), line.get(2)));
-}</pre>
+    LOG.debug(String.format(&quot;%s has an IQ of %s and is currently 
%s&quot;, line.get(0), line.get(1), line.get(2)));
+}]]></script>
 </div></div><h3 
id="BookDataFormatAppendix-MarshallingaList&lt;Map&gt;toCSV">Marshalling a 
List&lt;Map&gt; to CSV</h3><p><strong>Available as of Camel 
2.1</strong></p><p>If you have multiple rows of data you want to be marshalled 
into CSV format you can now store the message payload as a 
<code>List&lt;Map&lt;String, Object&gt;&gt;</code> object where the list 
contains a Map for each row.</p><h3 
id="BookDataFormatAppendix-FilePollerofCSV,thenunmarshaling">File Poller of 
CSV, then unmarshaling</h3><p>Given a bean which can handle the incoming 
data...</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>MyCsvHandler.java</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">// Some comments here
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[// Some comments here
 public void doHandleCsvData(List&lt;List&lt;String&gt;&gt; csvData)
 {
     // do magic here
 }
-</pre>
+]]></script>
 </div></div><p>... your route then looks as follows</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
         &lt;!-- poll every 10 seconds --&gt;
-        &lt;from 
uri="file:///some/path/to/pickup/csvfiles?delete=true&amp;amp;consumer.delay=10000"
 /&gt;
+        &lt;from 
uri=&quot;file:///some/path/to/pickup/csvfiles?delete=true&amp;amp;consumer.delay=10000&quot;
 /&gt;
         &lt;unmarshal&gt;&lt;csv /&gt;&lt;/unmarshal&gt;
-        &lt;to uri="bean:myCsvHandler?method=doHandleCsvData" /&gt;
+        &lt;to uri=&quot;bean:myCsvHandler?method=doHandleCsvData&quot; /&gt;
 &lt;/route&gt;
-</pre>
+]]></script>
 </div></div><h3 
id="BookDataFormatAppendix-Marshalingwithapipeasdelimiter">Marshaling with a 
pipe as delimiter</h3><p>&#160;</p><p>&#160;</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><td colspan="1" rowspan="1" 
class="confluenceTd">Considering the following body</td><td colspan="1" 
rowspan="1" class="confluenceTd"><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">Map&lt;String, Object&gt; body = new 
LinkedHashMap&lt;&gt;();
-body.put("foo", "abc");
-body.put("bar", 123);</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[Map&lt;String, Object&gt; body = new 
LinkedHashMap&lt;&gt;();
+body.put(&quot;foo&quot;, &quot;abc&quot;);
+body.put(&quot;bar&quot;, 123);]]></script>
 </div></div></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><span>and this Java route definition</span></td><td 
colspan="1" rowspan="1" class="confluenceTd"><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">// Camel version &lt; 2.15
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[// Camel version &lt; 2.15
 CsvDataFormat oldCSV = new CsvDataFormat();
-oldCSV.setDelimiter("|");
-from("direct:start")
+oldCSV.setDelimiter(&quot;|&quot;);
+from(&quot;direct:start&quot;)
     .marshal(oldCSV)
-    .to("mock:result")
-&#160;
+    .to(&quot;mock:result&quot;)
+ 
 // Camel version &gt;= 2.15
-from("direct:start")
-    .marshal(new CsvDataFormat().setDelimiter('|'))
-    .to("mock:result")</pre>
+from(&quot;direct:start&quot;)
+    .marshal(new CsvDataFormat().setDelimiter(&#39;|&#39;))
+    .to(&quot;mock:result&quot;)]]></script>
 </div></div></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><span>or this XML route definition</span></td><td 
colspan="1" rowspan="1" class="confluenceTd"><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
-  &lt;from uri="direct:start" /&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+  &lt;from uri=&quot;direct:start&quot; /&gt;
   &lt;marshal&gt;
-    &lt;csv delimiter="|" /&gt;
+    &lt;csv delimiter=&quot;|&quot; /&gt;
   &lt;/marshal&gt;
-  &lt;to uri="mock:result" /&gt;
-&lt;/route&gt;</pre>
+  &lt;to uri=&quot;mock:result&quot; /&gt;
+&lt;/route&gt;]]></script>
 </div></div></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><span>then it will produce</span></td><td colspan="1" 
rowspan="1" class="confluenceTd"><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: text; gutter: false; theme: Default" 
style="font-size:12px;">abc|123</pre>
+<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[abc|123]]></script>
 </div></div></td></tr></tbody></table></div><h3 
id="BookDataFormatAppendix-UsingautogenColumns,configRefandstrategyRefattributesinsideXMLDSL">Using
 autogenColumns, configRef and strategyRef attributes inside XML 
DSL</h3><p><strong>Available as of Camel 2.9.2 / 2.10 and deleted for Camel 
2.15</strong></p><p>You can customize the CSV <a shape="rect" 
href="data-format.html">Data Format</a> to make use of your own 
<code>CSVConfig</code> and/or <code>CSVStrategy</code>. Also note that the 
default value of the <code>autogenColumns</code> option is true. The following 
example should illustrate this customization.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
-  &lt;from uri="direct:start" /&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+  &lt;from uri=&quot;direct:start&quot; /&gt;
   &lt;marshal&gt;
-    &lt;!-- make use of a strategy other than the default one which is 
'org.apache.commons.csv.CSVStrategy.DEFAULT_STRATEGY' --&gt;
-    &lt;csv autogenColumns="false" delimiter="|" configRef="csvConfig" 
strategyRef="excelStrategy" /&gt;
+    &lt;!-- make use of a strategy other than the default one which is 
&#39;org.apache.commons.csv.CSVStrategy.DEFAULT_STRATEGY&#39; --&gt;
+    &lt;csv autogenColumns=&quot;false&quot; delimiter=&quot;|&quot; 
configRef=&quot;csvConfig&quot; strategyRef=&quot;excelStrategy&quot; /&gt;
   &lt;/marshal&gt;
-  &lt;convertBodyTo type="java.lang.String" /&gt;
-  &lt;to uri="mock:result" /&gt;
+  &lt;convertBodyTo type=&quot;java.lang.String&quot; /&gt;
+  &lt;to uri=&quot;mock:result&quot; /&gt;
 &lt;/route&gt;
 
-&lt;bean id="csvConfig" class="org.apache.commons.csv.writer.CSVConfig"&gt;
-  &lt;property name="fields"&gt;
+&lt;bean id=&quot;csvConfig&quot; 
class=&quot;org.apache.commons.csv.writer.CSVConfig&quot;&gt;
+  &lt;property name=&quot;fields&quot;&gt;
     &lt;list&gt;
-      &lt;bean class="org.apache.commons.csv.writer.CSVField"&gt;
-        &lt;property name="name" value="orderId" /&gt;
+      &lt;bean class=&quot;org.apache.commons.csv.writer.CSVField&quot;&gt;
+        &lt;property name=&quot;name&quot; value=&quot;orderId&quot; /&gt;
       &lt;/bean&gt;
-      &lt;bean class="org.apache.commons.csv.writer.CSVField"&gt;
-        &lt;property name="name" value="amount" /&gt;
+      &lt;bean class=&quot;org.apache.commons.csv.writer.CSVField&quot;&gt;
+        &lt;property name=&quot;name&quot; value=&quot;amount&quot; /&gt;
       &lt;/bean&gt;
     &lt;/list&gt;
   &lt;/property&gt;
 &lt;/bean&gt;
 
-&lt;bean id="excelStrategy" 
class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"&gt;
-  &lt;property name="staticField" 
value="org.apache.commons.csv.CSVStrategy.EXCEL_STRATEGY" /&gt;
+&lt;bean id=&quot;excelStrategy&quot; 
class=&quot;org.springframework.beans.factory.config.FieldRetrievingFactoryBean&quot;&gt;
+  &lt;property name=&quot;staticField&quot; 
value=&quot;org.apache.commons.csv.CSVStrategy.EXCEL_STRATEGY&quot; /&gt;
 &lt;/bean&gt;
-</pre>
+]]></script>
 </div></div><h3 
id="BookDataFormatAppendix-UsingskipFirstLineoptionwhileunmarshaling">Using 
skipFirstLine option while unmarshaling</h3><p><strong>Available as of Camel 
2.10 and deleted for Camel 2.15</strong></p><p>You can instruct the CSV <a 
shape="rect" href="data-format.html">Data Format</a> to skip the first line 
which contains the CSV headers. Using the Spring/XML DSL:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
-  &lt;from uri="direct:start" /&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+  &lt;from uri=&quot;direct:start&quot; /&gt;
   &lt;unmarshal&gt;
-    &lt;csv skipFirstLine="true" /&gt;
+    &lt;csv skipFirstLine=&quot;true&quot; /&gt;
   &lt;/unmarshal&gt;
-  &lt;to uri="bean:myCsvHandler?method=doHandleCsv" /&gt;
+  &lt;to uri=&quot;bean:myCsvHandler?method=doHandleCsv&quot; /&gt;
 &lt;/route&gt;
-</pre>
+]]></script>
 </div></div><p>Or the Java DSL:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">CsvDataFormat csv = new CsvDataFormat();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[CsvDataFormat csv = new CsvDataFormat();
 csv.setSkipFirstLine(true);
 
-from("direct:start")
+from(&quot;direct:start&quot;)
   .unmarshal(csv)
-.to("bean:myCsvHandler?method=doHandleCsv");
-</pre>
+.to(&quot;bean:myCsvHandler?method=doHandleCsv&quot;);
+]]></script>
 </div></div><h3 
id="BookDataFormatAppendix-Unmarshalingwithapipeasdelimiter">Unmarshaling with 
a pipe as delimiter</h3><p>Using the Spring/XML DSL:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;route&gt;
-  &lt;from uri="direct:start" /&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
+  &lt;from uri=&quot;direct:start&quot; /&gt;
   &lt;unmarshal&gt;
-    &lt;csv delimiter="|" /&gt;
+    &lt;csv delimiter=&quot;|&quot; /&gt;
   &lt;/unmarshal&gt;
-  &lt;to uri="bean:myCsvHandler?method=doHandleCsv" /&gt;
+  &lt;to uri=&quot;bean:myCsvHandler?method=doHandleCsv&quot; /&gt;
 &lt;/route&gt;
-</pre>
+]]></script>
 </div></div><p>Or the Java DSL:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">CsvDataFormat csv = new CsvDataFormat();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[CsvDataFormat csv = new CsvDataFormat();
 CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
-strategy.setDelimiter('|');
+strategy.setDelimiter(&#39;|&#39;);
 csv.setStrategy(strategy);
 
-from("direct:start")
+from(&quot;direct:start&quot;)
   .unmarshal(csv)
-  .to("bean:myCsvHandler?method=doHandleCsv");
-</pre>
+  .to(&quot;bean:myCsvHandler?method=doHandleCsv&quot;);
+]]></script>
 </div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">CsvDataFormat csv = new CsvDataFormat();
-csv.setDelimiter("|");
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[CsvDataFormat csv = new CsvDataFormat();
+csv.setDelimiter(&quot;|&quot;);
 
-from("direct:start")
+from(&quot;direct:start&quot;)
   .unmarshal(csv)
-  .to("bean:myCsvHandler?method=doHandleCsv");
-</pre>
+  .to(&quot;bean:myCsvHandler?method=doHandleCsv&quot;);
+]]></script>
 </div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">CsvDataFormat csv = new CsvDataFormat();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[CsvDataFormat csv = new CsvDataFormat();
 CSVConfig csvConfig = new CSVConfig();
-csvConfig.setDelimiter(";");
+csvConfig.setDelimiter(&quot;;&quot;);
 csv.setConfig(csvConfig);
 
-from("direct:start")
+from(&quot;direct:start&quot;)
   .unmarshal(csv)
-  .to("bean:myCsvHandler?method=doHandleCsv");
-</pre>
+  .to(&quot;bean:myCsvHandler?method=doHandleCsv&quot;);
+]]></script>
 </div></div><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Issue in 
CSVConfig</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>It looks like that</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">CSVConfig csvConfig = new CSVConfig();
-csvConfig.setDelimiter(';');
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[CSVConfig csvConfig = new CSVConfig();
+csvConfig.setDelimiter(&#39;;&#39;);
+]]></script>
 </div></div><p>doesn't work. You have to set the delimiter as a 
String!</p></div></div><h3 
id="BookDataFormatAppendix-Dependencies.3">Dependencies</h3><p>To use CSV in 
your Camel routes you need to add a dependency on <strong>camel-csv</strong>, 
which implements this data format.</p><p>If you use Maven you can just add the 
following to your pom.xml, substituting the version number for the latest and 
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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">&lt;dependency&gt;
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-csv&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
 &lt;/dependency&gt;
-</pre>
+]]></script>
 </div></div>
 The String <a shape="rect" href="data-format.html">Data Format</a> is a 
textual based format that supports encoding. 
 
@@ -594,37 +594,37 @@ The String <a shape="rect" href="data-fo
 <p>In this example we marshal the file content to String object in UTF-8 
encoding.</p>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-from("file://data.csv").marshal().string("UTF-8").to("jms://myqueue");
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+from(&quot;file://data.csv&quot;).marshal().string(&quot;UTF-8&quot;).to(&quot;jms://myqueue&quot;);
+]]></script>
 </div></div>
 
 <h3 id="BookDataFormatAppendix-Unmarshal">Unmarshal</h3>
 <p>In this example we unmarshal the payload from the JMS queue to a String 
object using UTF-8 encoding, before its processed by the newOrder processor. 
</p>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-from("jms://queue/order").unmarshal().string("UTF-8").processRef("newOrder");
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+from(&quot;jms://queue/order&quot;).unmarshal().string(&quot;UTF-8&quot;).processRef(&quot;newOrder&quot;);
+]]></script>
 </div></div>
 
 <h3 id="BookDataFormatAppendix-Dependencies.4">Dependencies</h3>
 
 <p>This data format is provided in <strong>camel-core</strong> so no 
additional dependencies is needed.</p>
 <h3 id="BookDataFormatAppendix-HL7DataFormat">HL7 DataFormat</h3><p>The <a 
shape="rect" href="hl7.html">HL7</a> component ships with a HL7 data format 
that can be used to marshal or unmarshal HL7 model objects.</p><ul 
class="alternate"><li><code>marshal</code> = from Message to byte stream (can 
be used when responding using the HL7 MLLP 
codec)</li><li><code>unmarshal</code> = from byte stream to Message (can be 
used when receiving streamed data from the HL7 MLLP</li></ul><p>To use the data 
format, simply instantiate an instance and invoke the marshal or unmarshal 
operation in the route builder:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">  DataFormat hl7 = new HL7DataFormat();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  DataFormat hl7 = new HL7DataFormat();
   ...
-  from("direct:hl7in").marshal(hl7).to("jms:queue:hl7out");
-</pre>
+  from(&quot;direct:hl7in&quot;).marshal(hl7).to(&quot;jms:queue:hl7out&quot;);
+]]></script>
 </div></div><p>In the sample above, the HL7 is marshalled from a HAPI Message 
object to a byte stream and put on a JMS queue.<br clear="none"> The next 
example is the opposite:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">  DataFormat hl7 = new HL7DataFormat();
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  DataFormat hl7 = new HL7DataFormat();
   ...
-  from("jms:queue:hl7out").unmarshal(hl7).to("patientLookupService");
-</pre>
+  
from(&quot;jms:queue:hl7out&quot;).unmarshal(hl7).to(&quot;patientLookupService&quot;);
+]]></script>
 </div></div><p>Here we unmarshal the byte stream into a HAPI Message object 
that is passed to our patient lookup service.</p><div 
class="confluence-information-macro confluence-information-macro-tip"><p 
class="title">Serializable messages</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 HAPI 2.0 (used by 
<strong>Camel 2.11</strong>), the HL7v2 model classes are fully serializable. 
So you can put HL7v2 messages directly into a JMS queue (i.e. without calling 
<code>marshal()</code> and read them again directly from the queue (i.e. 
without calling <code>unmarshal()</code>.</p></div></div><div 
class="confluence-information-macro confluence-information-macro-note"><p 
class="title">Segment separators</p><span class="aui-icon aui-icon-small 
aui-iconfont-warning confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>As of <strong>Camel 2.11</stro
 ng>, <code>unmarshal</code> does not automatically fix segment separators 
anymore by converting <code>\n</code> to <code>\r</code>. If you <br 
clear="none"> need this conversion, 
<code>org.apache.camel.component.hl7.HL7#convertLFToCR</code> provides a handy 
<code>Expression</code> for this purpose.</p></div></div><div 
class="confluence-information-macro confluence-information-macro-note"><p 
class="title">Charset</p><span class="aui-icon aui-icon-small 
aui-iconfont-warning confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>As of <strong>Camel 
2.14.1</strong>, both <code>marshal and unmarshal</code> evaluate the charset 
provided in the field&#160;<code>MSH-18</code>. If this field is empty, by 
default the charset contained in the corresponding Camel charset 
property/header is assumed. You can even change this default behavior by 
overriding the <code>guessCharsetName</code> method when inheriting from the 
<code>HL7DataFormat</code> class.</p></d
 iv></div><p>&#160;</p><p>There is a shorthand syntax in Camel for well-known 
data formats that are commonly used.<br clear="none"> Then you don't need to 
create an instance of the <code>HL7DataFormat</code> object:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">  
from("direct:hl7in").marshal().hl7().to("jms:queue:hl7out");
-  from("jms:queue:hl7out").unmarshal().hl7().to("patientLookupService");
-</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  
from(&quot;direct:hl7in&quot;).marshal().hl7().to(&quot;jms:queue:hl7out&quot;);
+  
from(&quot;jms:queue:hl7out&quot;).unmarshal().hl7().to(&quot;patientLookupService&quot;);
+]]></script>
 </div></div><p>&#160;</p><p>&#160;</p>
 <h2 id="BookDataFormatAppendix-EDIDataFormat">EDI DataFormat</h2>
 
@@ -645,24 +645,24 @@ The result of the operation will contain
 <h3 id="BookDataFormatAppendix-Usage">Usage</h3>
 <p>To use the data format, simply instantiate an instance and invoke the 
marshal or unmarshal operation in the route builder:</p>
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
   FlatpackDataFormat fp = new FlatpackDataFormat();
-  fp.setDefinition(new ClassPathResource("INVENTORY-Delimited.pzmap.xml"));
+  fp.setDefinition(new 
ClassPathResource(&quot;INVENTORY-Delimited.pzmap.xml&quot;));
   ...
-  from("file:order/in").unmarshal(df).to("seda:queue:neworder");
-</pre>
+  
from(&quot;file:order/in&quot;).unmarshal(df).to(&quot;seda:queue:neworder&quot;);
+]]></script>
 </div></div>
 <p>The sample above will read files from the <code>order/in</code> folder and 
unmarshal the input using the Flatpack configuration file 
<code>INVENTORY-Delimited.pzmap.xml</code> that configures the structure of the 
files. The result is a <code>DataSetList</code> object we store on the SEDA 
queue.</p>
 
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 FlatpackDataFormat df = new FlatpackDataFormat();
-df.setDefinition(new ClassPathResource("PEOPLE-FixedLength.pzmap.xml"));
+df.setDefinition(new 
ClassPathResource(&quot;PEOPLE-FixedLength.pzmap.xml&quot;));
 df.setFixed(true);
 df.setIgnoreFirstRecord(false);
 
-from("seda:people").marshal(df).convertBodyTo(String.class).to("jms:queue:people");
-</pre>
+from(&quot;seda:people&quot;).marshal(df).convertBodyTo(String.class).to(&quot;jms:queue:people&quot;);
+]]></script>
 </div></div>
 <p>In the code above we marshal the data from a Object representation as a 
<code>List</code> of rows as <code>Maps</code>. The rows as <code>Map</code> 
contains the column name as the key, and the the corresponding value. This 
structure can be created in Java code from e.g. a processor. We marshal the 
data according to the Flatpack format and convert the result as a 
<code>String</code> object and store it on a JMS queue.</p>
 
@@ -673,46 +673,46 @@ from("seda:people").marshal(df).convertB
 <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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-flatpack&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
 &lt;/dependency&gt;
-</pre>
+]]></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="http://xircles.codehaus.org/projects/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..." paragra
 phs further 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 XStream library</h3><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">// lets turn Object messages into json then send to 
MQSeries
-from("activemq:My.Queue").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[// lets turn Object messages into json then 
send to MQSeries
+from(&quot;activemq:My.Queue&quot;).
   marshal().json().
-  to("mqseries:Another.Queue");
-</pre>
+  to(&quot;mqseries:Another.Queue&quot;);
+]]></script>
 </div></div><h3 
id="BookDataFormatAppendix-UsingJSONdataformatwiththeJacksonlibrary">Using JSON 
data format with the Jackson library</h3><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">// lets turn Object messages into json then send to 
MQSeries
-from("activemq:My.Queue").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[// lets turn Object messages into json then 
send to MQSeries
+from(&quot;activemq:My.Queue&quot;).
   marshal().json(JsonLibrary.Jackson).
-  to("mqseries:Another.Queue");
-</pre>
+  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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">// lets turn Object messages into json then send to 
MQSeries
-from("activemq:My.Queue").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[// lets turn Object messages into json then 
send to MQSeries
+from(&quot;activemq:My.Queue&quot;).
   marshal().json(JsonLibrary.Gson).
-  to("mqseries:Another.Queue");
-</pre>
+  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>DataFormats</strong> XML tag.</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">        &lt;dataFormats&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[        &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="jack" library="Jackson" 
unmarshalTypeName="org.apache.camel.component.jackson.TestPojo"/&gt;
+            &lt;json id=&quot;jack&quot; library=&quot;Jackson&quot; 
unmarshalTypeName=&quot;org.apache.camel.component.jackson.TestPojo&quot;/&gt;
         &lt;/dataFormats&gt;
-</pre>
+]]></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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">       &lt;route&gt;
-            &lt;from uri="direct:back"/&gt;
-            &lt;unmarshal ref="jack"/&gt;
-            &lt;to uri="mock:reverse"/&gt;
+<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;
         &lt;/route&gt;
-</pre>
+]]></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 marshalling 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. 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 {
@@ -737,8 +737,8 @@ JacksonDataFormat ageViewFormat = new Ja
 from(&quot;direct:inPojoAgeView&quot;).marshal(ageViewFormat);
 ]]></script>
 </div></div><p>Note that the weight field is missing in the resulting 
JSON:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">{"age":30, "weight":70}
-</pre>
+<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[
 /**
@@ -763,14 +763,14 @@ GsonDataFormat ageExclusionFormat = new
 from(&quot;direct:inPojoExcludeAge&quot;).marshal(ageExclusionFormat);
 ]]></script>
 </div></div><p>The line above will exclude fields annotated with 
<code>@ExcludeAge</code> when marshalling to JSON.</p><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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">{
-  "id" : 123,
-  "first_name" : "Donald"
-  "last_name" : "Duck"
+<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;
 }
-</pre>
+]]></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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">public class PersonPojo {
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[public class PersonPojo {
 
     private int id;
     private String firstName;
@@ -800,140 +800,140 @@ from(&quot;direct:inPojoExcludeAge&quot;
         this.lastName = lastName;
     }
 }
-</pre>
+]]></script>
 </div></div><p>Then we can configure the 
<code>org.apache.camel.component.gson.GsonDataFormat</code> in a Spring XML 
files as shown below. Notice we use <code>fieldNamingPolicy</code> property to 
set the field mapping. This property is an enum from GSon 
<code>com.google.gson.FieldNamingPolicy</code> which has a number of pre 
defined mappings. If you need full control you can use the property 
<code>FieldNamingStrategy</code> and implement a custom 
<code>com.google.gson.FieldNamingStrategy</code> 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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">    &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;
+<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;
         &lt;!-- we want to unmarshal to person pojo --&gt;
-        &lt;property name="unmarshalType" 
value="org.apache.camel.component.gson.PersonPojo"/&gt;
+        &lt;property name=&quot;unmarshalType&quot; 
value=&quot;org.apache.camel.component.gson.PersonPojo&quot;/&gt;
         &lt;!-- we want to map fields to use lower case and underscores --&gt;
-        &lt;property name="fieldNamingPolicy" 
value="LOWER_CASE_WITH_UNDERSCORES"/&gt;
+        &lt;property name=&quot;fieldNamingPolicy&quot; 
value=&quot;LOWER_CASE_WITH_UNDERSCORES&quot;/&gt;
     &lt;/bean&gt;
-</pre>
+]]></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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">   &lt;camelContext 
xmlns="http://camel.apache.org/schema/spring"&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[   &lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
 
         &lt;route&gt;
-            &lt;from uri="direct:inPojo"/&gt;
-            &lt;marshal ref="gson"/&gt;
+            &lt;from uri=&quot;direct:inPojo&quot;/&gt;
+            &lt;marshal ref=&quot;gson&quot;/&gt;
         &lt;/route&gt;
 
         &lt;route&gt;
-            &lt;from uri="direct:backPojo"/&gt;
-            &lt;unmarshal ref="gson"/&gt;
+            &lt;from uri=&quot;direct:backPojo&quot;/&gt;
+            &lt;unmarshal ref=&quot;gson&quot;/&gt;
         &lt;/route&gt;
 
     &lt;/camelContext&gt;
-</pre>
+]]></script>
 </div></div><h3 
id="BookDataFormatAppendix-Include/ExcludefieldsusingthejsonViewattributewithJacksonDataFormat">Include/Exclude
 fields using the <code>jsonView</code> 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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">JacksonDataFormat ageViewFormat = new 
JacksonDataFormat(TestPojoView.class, Views.Age.class);
-from("direct:inPojoAgeView").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[JacksonDataFormat ageViewFormat = new 
JacksonDataFormat(TestPojoView.class, Views.Age.class);
+from(&quot;direct:inPojoAgeView&quot;).
   marshal(ageViewFormat);
-</pre>
+]]></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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">from("direct:inPojoAgeView").
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:inPojoAgeView&quot;).
   marshal().json(TestPojoView.class, Views.Age.class);
-</pre>
+]]></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">
-<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;from uri="direct:inPojoAgeView"/&gt;
+<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;from 
uri=&quot;direct:inPojoAgeView&quot;/&gt;
   &lt;marshal&gt;
-    &lt;json library="Jackson" 
unmarshalTypeName="org.apache.camel.component.jackson.TestPojoView" 
jsonView="org.apache.camel.component.jackson.Views$Age"/&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;/marshal&gt;
-</pre>
+]]></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 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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">@JsonInclude(Include.NON_NULL)
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[@JsonInclude(Include.NON_NULL)
 public class MyPojo {
    ...
-}</pre>
+}]]></script>
 </div></div><p>But this requires you to include that annotation in your pojo 
source code. You can also configure the Camel JsonDataFormat to set the include 
option, as shown below:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">JacksonDataFormat format = new JacksonDataFormat();
-format.setInclude("NON_NULL");</pre>
+<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">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">    &lt;dataFormats&gt;
-      &lt;json id="json" library="Jackson" include="NOT_NULL"/&gt;
-    &lt;/dataFormats&gt;</pre>
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[    &lt;dataFormats&gt;
+      &lt;json id=&quot;json&quot; library=&quot;Jackson&quot; 
include=&quot;NOT_NULL&quot;/&gt;
+    &lt;/dataFormats&gt;]]></script>

[... 1961 lines stripped ...]

Reply via email to