Modified: websites/production/camel/content/jaxb.html
==============================================================================
--- websites/production/camel/content/jaxb.html (original)
+++ websites/production/camel/content/jaxb.html Fri Jun 6 12:18:21 2014
@@ -86,40 +86,19 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="JAXB-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="JAXB-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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-DataFormat jaxb = new JaxbDataFormat("com.acme.model");
+<div class="wiki-content maincontent"><h2 id="JAXB-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="JAXB-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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[DataFormat jaxb = new
JaxbDataFormat("com.acme.model");
from("activemq:My.Queue").
unmarshal(jaxb).
to("mqseries:Another.Queue");
]]></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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-from("activemq:My.Queue").
+</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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[from("activemq:My.Queue").
unmarshal("myJaxbDataType").
to("mqseries:Another.Queue");
]]></script>
-</div></div>
-
-
-<h3 id="JAXB-UsingSpringXML">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">
+</div></div><h3 id="JAXB-UsingSpringXML">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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring">
<route>
@@ -131,11 +110,7 @@ from("activemq:My.Queue").
</route>
</camelContext>
]]></script>
-</div></div>
-
-<p>This example shows how to configure the data type just once and reuse it on
multiple routes.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><p>This example shows how to configure the data type just once and
reuse it on multiple routes.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
@@ -155,24 +130,14 @@ from("activemq:My.Queue").
</camelContext>
]]></script>
-</div></div>
-
- <div class="aui-message success shadowed information-macro">
+</div></div> <div class="aui-message success shadowed information-macro">
<p class="title">Multiple context paths</p>
<span class="aui-icon icon-success">Icon</span>
<div class="message-content">
-
-<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>
+ <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="JAXB-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.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<h3 id="JAXB-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.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring">
<route>
@@ -195,54 +160,15 @@ In that case you can use partial unmarsh
</route>
</camelContext>
]]></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="JAXB-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 fales. </p>
-
-<h3 id="JAXB-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 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> </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
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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
- JaxbDataFormat customWriterFormat = new
JaxbDataFormat("org.apache.camel.foo.bar");
+</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="JAXB-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 fales.</p><h3
id="JAXB-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 c
haracter 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> </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 te
sted 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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[ 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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<bean id="testXmlStreamWriterWrapper"
class="org.apache.camel.jaxb.TestXmlStreamWriter"/>
+</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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<bean
id="testXmlStreamWriterWrapper"
class="org.apache.camel.jaxb.TestXmlStreamWriter"/>
<jaxb filterNonXmlChars="true"
contextPath="org.apache.camel.foo.bar"
xmlStreamWriterWrapper="#testXmlStreamWriterWrapper" />
]]></script>
-</div></div>
-
-<h3 id="JAXB-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="JAXB-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">
+</div></div><h3 id="JAXB-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="JAXB-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 Mars
haller.<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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring">
<route>
@@ -254,89 +180,50 @@ You can setup which encoding to use when
</route>
</camelContext>
]]></script>
-</div></div>
-
-
-<h3 id="JAXB-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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
- <util:map id="myMap">
+</div></div><h3 id="JAXB-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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[ <util:map id="myMap">
<entry key="http://www.w3.org/2003/05/soap-envelope"
value="soap"/>
<!-- we dont want any prefix for our namespace -->
<entry key="http://www.mycompany.com/foo/2"
value=""/>
</util:map>
]]></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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
- <marshal>
+</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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[ <marshal>
<soapjaxb version="1.2"
contextPath="com.mycompany.foo"
namespacePrefixRef="myMap"/>
</marshal>
]]></script>
-</div></div>
-
-
-<h3 id="JAXB-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="aui-message hint shadowed information-macro">
+</div></div><h3 id="JAXB-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="aui-message hint
shadowed information-macro">
<p class="title">Known issue</p>
<span class="aui-icon icon-hint">Icon</span>
<div class="message-content">
-
-<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>
+ <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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
+<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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new
JaxbDataFormat();
jaxbDataFormat.setContextPath(Person.class.getPackage().getName());
jaxbDataFormat.setSchema("classpath:person.xsd,classpath:address.xsd");
]]></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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<marshal>
+</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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<marshal>
<jaxb id="jaxb"
schema="classpath:person.xsd,classpath:address.xsd"/>
</marshal>
]]></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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-JaxbDataFormat jaxbDataFormat = new JaxbDataFormat();
+</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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new
JaxbDataFormat();
jaxbDataFormat.setSchemaFactory(thradSafeSchemaFactory);
]]></script>
-</div></div>
-
-
-<h3 id="JAXB-Dependencies">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 & 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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+</div></div><h3 id="JAXB-SchemaLocation">Schema
Location</h3><p><strong>Available as of Camel 2.14</strong></p><p>The
JAXB <a shape="rect" href="data-format.html">Data Format</a> supports
to specify the SchemaLocation when marshaling the XML. </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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[JaxbDataFormat jaxbDataFormat = new
JaxbDataFormat();
+jaxbDataFormat.setContextPath(Person.class.getPackage().getName());
+jaxbDataFormat.setSchemaLocation("schema/person.xsd");
+]]></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="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<marshal>
+ <jaxb id="jaxb"
schemaLocation="schema/person.xsd"/>
+</marshal>]]></script>
+</div></div><h3 id="JAXB-Dependencies">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
& 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="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxb</artifactId>
<version>x.x.x</version>