You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2017/02/10 20:18:36 UTC

svn commit: r1006524 - in /websites/production/camel/content: cache/main.pageCache xmljson.html

Author: buildbot
Date: Fri Feb 10 20:18:36 2017
New Revision: 1006524

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/xmljson.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/xmljson.html
==============================================================================
--- websites/production/camel/content/xmljson.html (original)
+++ websites/production/camel/content/xmljson.html Fri Feb 10 20:18:36 2017
@@ -86,9 +86,9 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="XmlJson-XMLJSONDataFormat(camel-xmljson)">XML JSON Data Format (camel-xmljson)</h2><p><strong>Available as of Camel 2.10</strong></p><p>Camel already supports a number of data formats to perform XML and JSON-related conversions, but all of them require a POJO either as an input (for marshalling) or produce a POJO as output (for unmarshalling). This data format provides the capability to convert from XML to JSON and viceversa directly, without stepping through intermediate POJOs.</p><p>This data format leverages the <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/" rel="nofollow">Json-lib</a> library to achieve direct conversion. In this context, XML is considered the high-level format, while JSON is the low-level format. Hence, the marshal/unmarshal semantics are assigned as follows:</p><ul><li>marshalling =&gt; converting from XML to JSON</li><li>unmarshalling =&gt; converting from JSON to XML.</li></ul><h3 i
 d="XmlJson-Options">Options</h3><p>This data format supports the following options. You can set them via all DSLs. The defaults marked with&#160;<strong><code>(*)</code></strong> are determined by <strong><code>json-lib</code></strong>, rather than the code of the data format itself. They are reproduced here for convenience to avoid having to consult the <strong><code>json-lib</code></strong> documentation directly.</p><div class="confluenceTableSmall"><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>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>encoding</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>UTF-8 (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span> <strong>(JSON to XML conversion).</strong></p><p>Sets the encoding for the call to <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/apidocs/net/sf/json/xml/XMLSerializer.html#write(net.sf.json.JSON, java.lang.String)" rel="nofollow"><code>XMLSeriali
 zer.write()</code></a> method, hence it is only used when producing XML. <br clear="none" class="atl-forced-newline"> However, when producing JSON, the encoding is determined by the input String being processed.</p><p>If the conversion is performed on an <strong><code>InputStream</code></strong>,&#160;<strong><code>json-lib</code></strong> uses the platform's default encoding, e.g., determined by the <strong><code>file.encoding</code></strong> system property.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>elementName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>'e' (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>Specifies the name of the XML elements representing each array 
 element.</p><p>See <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/snippets.html#JSONObject_to_XML_change_node_names" rel="nofollow">json-lib doc</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>arrayName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>'a' (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>Specifies the name of the top-level XML element.</p><p>For example, when converting:</p><p><strong><code>[1, 2, 3]</code></strong></p><p>it is, by default, translated as:</p><p><strong><code>&lt;a&gt;&lt;e&gt;1&lt;/e&gt;&lt;e&gt;2&lt;/e&gt;&lt;e&gt;3&lt;/e&gt;&lt;/a&gt;</code></strong></p><p>By setting this option or <strong><code>rootName</code></s
 trong>, you can alter the name of the element <strong><code>a</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>rootName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>none (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>When converting any JSON construct (<strong><code>object</code>, <code>array</code>, <code>null</code></strong>) to XML (unmarshalling), this option specifies the name of the top-level XML element.</p><p>If not set,&#160;<strong><code>json-lib</code></strong> will use <strong><code>arrayName</code></strong> or&#160;<strong><code>objectName</code></strong> (default value: <strong><code>o</code></strong>, at the current time it is not configurable i
 n this data format).</p><p>If set to <strong><code>root</code></strong>, the JSON string:</p><p><strong><code>{ "x": "value1", "y" : "value2" }</code></strong>&#160;</p><p>is translated as:</p><p><strong><code>&lt;root&gt;&lt;x&gt;value1&lt;/x&gt;&lt;y&gt;value2&lt;/y&gt;&lt;/root&gt;</code></strong></p><p>otherwise the&#160;<strong><code>root</code></strong> element would be named <strong><code>o</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>namespaceLenient</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>According to the <strong><strong><code>json-lib</code></strong></strong> docs: "<em>Flag to be toleran
 t to incomplete namespace prefixes.</em>"</p><p>In most cases, <strong><strong><code>json-lib</code></strong></strong> automatically changes this flag at runtime to match the processing.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>namespaceMappings</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>List&lt;NamespacesPerElementMapping&gt;</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>none</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>Binds namespace prefixes and URIs to specific JSON elements.&#160;</p><p><strong><code>NamespacesPerElementMapping</code></strong> is a wrapper around an element name + a map of prefixes against URIs.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>expandableProperties</code></
 p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>List&lt;String&gt;</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>none</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>With expandable properties, JSON array elements are converted to XML as a sequence of repetitive XML elements with the local name equal to the JSON key.</p><p>For example, the following JSON:&#160;</p><p><strong><code>{ "number": 1,2,3 }</code></strong></p><p>is normally translated as:</p><p><strong><code>&lt;number&gt;&lt;e&gt;1&lt;/e&gt;&lt;e&gt;2&lt;/e&gt;&lt;e&gt;3&lt;/e&gt;&lt;/number&gt;</code></strong></p><p>where&#160;<strong><code>e</code></strong> can be modified by setting&#160;<strong><code>elementName</code></strong>.</p><p>However, if&#160;<strong><code>number</code></strong> is set as an expa
 ndable property, it's translated as:</p><p><strong><code>&lt;number&gt;1&lt;/number&gt;&lt;number&gt;2&lt;/number&gt;&lt;number&gt;3&lt;/number&gt;</code></strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>typeHints</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>TypeHintsEnum</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>YES</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>Adds type hints to the resulting XML to aid conversion back to JSON.&#160;See documentation <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/apidocs/net/sf/json/xml/XMLSerializer.html" rel="nofollow">here</a> for an explanation.</p><p><strong><code>TypeHintsEnum</code></strong> comprises the following values, which lead to different c
 ombinations of the underlying XMLSerializer's <strong><code>typeHintsEnabled</code></strong> and <strong><code>typeHintsCompatibility</code></strong> flags:</p>
-     <ul><li><p><code>TypeHintsEnum.NO</code>&#160;<strong><code>=&gt;</code></strong> <code>typeHintsEnabled</code>&#160;=&#160;<code>false</code></p></li><li><p><code>TypeHintsEnum.YES</code>&#160;<strong><code>=&gt;</code></strong>&#160; <code>typeHintsEnabled</code> = <code>true</code>,&#160;&#160;<code>typeHintsCompatibility</code> =&#160;<code>true</code></p></li><li><p><code>TypeHintsEnum.WITH_PREFIX</code>&#160;<strong><code>=&gt;</code></strong>&#160; <code>typeHintsEnabled</code> = <code>true</code>,&#160;&#160;<code>typeHintsCompatibility</code> = <code>false</code></p></li></ul></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>forceTopLevelObject</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marsh
 alling</strong></span> <strong>(XML to JSON conversion).</strong></p><p>Determines whether the resulting JSON will start off with a top-most element whose name matches the XML root element.</p><p>If this option is <strong><code>false</code></strong>, the XML string:</p><p><strong><code>&lt;a&gt;&lt;x&gt;1&lt;/x&gt;&lt;y&gt;2&lt;/y&gt;&lt;/a&gt;</code></strong></p><p>is translated as:</p><p><strong><code>{"x": "1", "y": "2"}</code></strong></p><p>If&#160;<strong><code>true</code></strong>, it's translated as:</p><p><strong><code>{ "a":&#160; { "x": "1", "y": "2" }}</code></strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>skipWhitespace</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marshalling</stro
 ng></span><strong>&#160;(XML to JSON conversion).</strong></p><p>Determines whether white spaces between XML elements will be regarded as text values or disregarded.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>trimSpaces</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marshalling</strong></span><strong>&#160;(XML to JSON conversion).</strong></p><p>Determines whether leading and trailing white spaces will be omitted from String values.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>skipNamespaces</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><t
 d colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marshalling</strong></span><strong>&#160;(XML to JSON conversion).</strong></p><p>Signals whether namespaces should be ignored. By default they will be added to the JSON output using&#160;<strong><code>@xmlns</code></strong> elements.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>removeNamespacePrefixes</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marshalling</strong></span><strong>&#160;(XML to JSON conversion).</strong></p><p>Removes the namespace prefixes from XML qualified elements, so that the resulting JSON string does not contain them.</p></td></tr></tbody></table>
+<div class="wiki-content maincontent"><h2 id="XmlJson-XMLJSONDataFormat(camel-xmljson)">XML JSON Data Format (camel-xmljson)</h2><p><strong>Available as of Camel 2.10</strong></p><p>Camel already supports a number of data formats to perform XML and JSON-related conversions, but all of them require a POJO either as an input (for marshalling) or produce a POJO as output (for un-marshaling). This data format provides the capability to convert from XML to JSON and viceversa directly, without stepping through intermediate POJOs.</p><p>This data format leverages the <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/" rel="nofollow">Json-lib</a> library to achieve direct conversion. In this context, XML is considered the high-level format, while JSON is the low-level format. Hence, the marshal/unmarshal semantics are assigned as follows:</p><ul><li>marshalling =&gt; converting from XML to JSON</li><li>un-marshaling =&gt; converting from JSON to XML.</li></ul><h3 i
 d="XmlJson-Options">Options</h3><p>This data format supports the following options. You can set them via all DSLs. The defaults marked with&#160;<strong><code>(*)</code></strong> are determined by <strong><code>json-lib</code></strong>, rather than the code of the data format itself. They are reproduced here for convenience to avoid having to consult the <strong><code>json-lib</code></strong> documentation directly.</p><div class="confluenceTableSmall"><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>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>encoding</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>UTF-8 (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>un-marshaling</strong></span> <strong>(JSON to XML conversion).</strong></p><p>Sets the encoding for the call to <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/apidocs/net/sf/json/xml/XMLSerializer.html#write(net.sf.json.JSON, java.lang.String)" rel="nofollow"><code>XMLSeriali
 zer.write()</code></a> method, hence it is only used when producing XML. <br clear="none" class="atl-forced-newline"> However, when producing JSON, the encoding is determined by the input String being processed.</p><p>If the conversion is performed on an <strong><code>InputStream</code></strong>,&#160;<strong><code>json-lib</code></strong> uses the platform's default encoding, e.g., determined by the <strong><code>file.encoding</code></strong> system property.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>elementName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>'e' (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>un-marshaling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>Specifies the name of the XML elements representing each array 
 element.</p><p>See <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/snippets.html#JSONObject_to_XML_change_node_names" rel="nofollow">json-lib doc</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>arrayName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>'a' (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>un-marshaling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>Specifies the name of the top-level XML element.</p><p>For example, when converting:</p><p><strong><code>[1, 2, 3]</code></strong></p><p>it is, by default, translated as:</p><p><strong><code>&lt;a&gt;&lt;e&gt;1&lt;/e&gt;&lt;e&gt;2&lt;/e&gt;&lt;e&gt;3&lt;/e&gt;&lt;/a&gt;</code></strong></p><p>By setting this option or <strong><code>rootName</code></s
 trong>, you can alter the name of the element <strong><code>a</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>rootName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>none (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>un-marshaling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>When converting any JSON construct (<strong><code>object</code>, <code>array</code>, <code>null</code></strong>) to XML (un-marshaling), this option specifies the name of the top-level XML element.</p><p>If not set,&#160;<strong><code>json-lib</code></strong> will use <strong><code>arrayName</code></strong> or&#160;<strong><code>objectName</code></strong> (default value: <strong><code>o</code></strong>, at the current time it is not configurable i
 n this data format).</p><p>If set to <strong><code>root</code></strong>, the JSON string:</p><p><strong><code>{ "x": "value1", "y" : "value2" }</code></strong>&#160;</p><p>is translated as:</p><p><strong><code>&lt;root&gt;&lt;x&gt;value1&lt;/x&gt;&lt;y&gt;value2&lt;/y&gt;&lt;/root&gt;</code></strong></p><p>otherwise the&#160;<strong><code>root</code></strong> element would be named <strong><code>o</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>namespaceLenient</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>un-marshaling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>According to the <strong><strong><code>json-lib</code></strong></strong> docs: "<em>Flag to be toleran
 t to incomplete namespace prefixes.</em>"</p><p>In most cases, <strong><strong><code>json-lib</code></strong></strong> automatically changes this flag at runtime to match the processing.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>namespaceMappings</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>List&lt;NamespacesPerElementMapping&gt;</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>none</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>un-marshaling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>Binds namespace prefixes and URIs to specific JSON elements.&#160;</p><p><strong><code>NamespacesPerElementMapping</code></strong> is a wrapper around an element name + a map of prefixes against URIs.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>expandableProperties</code></
 p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>List&lt;String&gt;</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>none</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>un-marshaling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>With expandable properties, JSON array elements are converted to XML as a sequence of repetitive XML elements with the local name equal to the JSON key.</p><p>For example, the following JSON:&#160;</p><p><strong><code>{ "number": 1,2,3 }</code></strong></p><p>is normally translated as:</p><p><strong><code>&lt;number&gt;&lt;e&gt;1&lt;/e&gt;&lt;e&gt;2&lt;/e&gt;&lt;e&gt;3&lt;/e&gt;&lt;/number&gt;</code></strong></p><p>where&#160;<strong><code>e</code></strong> can be modified by setting&#160;<strong><code>elementName</code></strong>.</p><p>However, if&#160;<strong><code>number</code></strong> is set as an expa
 ndable property, it's translated as:</p><p><strong><code>&lt;number&gt;1&lt;/number&gt;&lt;number&gt;2&lt;/number&gt;&lt;number&gt;3&lt;/number&gt;</code></strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>typeHints</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>TypeHintsEnum</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>YES</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>un-marshaling</strong></span><strong>&#160;(JSON to XML conversion).</strong></p><p>Adds type hints to the resulting XML to aid conversion back to JSON.&#160;See documentation <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/apidocs/net/sf/json/xml/XMLSerializer.html" rel="nofollow">here</a> for an explanation.</p><p><strong><code>TypeHintsEnum</code></strong> comprises the following values, which lead to different c
 ombinations of the underlying XMLSerializer's <strong><code>typeHintsEnabled</code></strong> and <strong><code>typeHintsCompatibility</code></strong> flags:</p>
+     <ul><li><p><code>TypeHintsEnum.NO</code>&#160;<strong><code>=&gt;</code></strong> <code>typeHintsEnabled</code>&#160;=&#160;<code>false</code></p></li><li><p><code>TypeHintsEnum.YES</code>&#160;<strong><code>=&gt;</code></strong>&#160; <code>typeHintsEnabled</code> = <code>true</code>,&#160;&#160;<code>typeHintsCompatibility</code> =&#160;<code>true</code></p></li><li><p><code>TypeHintsEnum.WITH_PREFIX</code>&#160;<strong><code>=&gt;</code></strong>&#160; <code>typeHintsEnabled</code> = <code>true</code>,&#160;&#160;<code>typeHintsCompatibility</code> = <code>false</code></p></li></ul></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>forceTopLevelObject</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marsh
 aling</strong></span> <strong>(XML to JSON conversion).</strong></p><p>Determines whether the resulting JSON will start off with a top-most element whose name matches the XML root element.</p><p>If this option is <strong><code>false</code></strong>, the XML string:</p><p><strong><code>&lt;a&gt;&lt;x&gt;1&lt;/x&gt;&lt;y&gt;2&lt;/y&gt;&lt;/a&gt;</code></strong></p><p>is translated as:</p><p><strong><code>{"x": "1", "y": "2"}</code></strong></p><p>If&#160;<strong><code>true</code></strong>, it's translated as:</p><p><strong><code>{ "a":&#160; { "x": "1", "y": "2" }}</code></strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>skipWhitespace</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marshaling</strong
 ></span><strong>&#160;(XML to JSON conversion).</strong></p><p>Determines whether white spaces between XML elements will be regarded as text values or disregarded.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>trimSpaces</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marshaling</strong></span><strong>&#160;(XML to JSON conversion).</strong></p><p>Determines whether leading and trailing white spaces will be omitted from String values.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>skipNamespaces</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td c
 olspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marshaling</strong></span><strong>&#160;(XML to JSON conversion).</strong></p><p>Signals whether namespaces should be ignored. By default they will be added to the JSON output using&#160;<strong><code>@xmlns</code></strong> elements.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>removeNamespacePrefixes</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false (*)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span style="color: rgb(51,51,153);"><strong>marshaling</strong></span><strong>&#160;(XML to JSON conversion).</strong></p><p>Removes the namespace prefixes from XML qualified elements, so that the resulting JSON string does not contain them.</p></td></tr></tbody></table>
 </div></div><h3 id="XmlJson-BasicUsageWiththeJavaDSL">Basic Usage With the Java DSL</h3><h4 id="XmlJson-ExplicitlyInstantiatingtheDataFormat">Explicitly Instantiating the DataFormat</h4><p>Just instantiate the&#160;<strong><code>XmlJsonDataFormat</code></strong> from package <strong><code>org.apache.camel.dataformat.xmljson</code></strong>. Make sure you have installed the <strong><code>camel-xmljson</code></strong> feature (if running on OSGi) or that you've included&#160;<strong><code>camel-xmljson-{version}.jar</code></strong> and its transitive dependencies in your classpath.</p><p>Example, initialization with a default configuration:</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[XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();
 ]]></script>
@@ -141,7 +141,7 @@ from(&quot;direct:marshalInlineOptions&q
   .xmljson(xmlJsonOptions)
   .to(&quot;mock:jsonInlineOptions&quot;);
 
-// Fromm JSON to XML - inline dataformat w/options
+// From JSON to XML - inline dataformat w/options
 from(&quot;direct:unmarshalInlineOptions&quot;)
   .unmarshal()
   .xmljson(xmlJsonOptions)
@@ -172,7 +172,7 @@ from(&quot;direct:unmarshalInlineOptions
     &lt;to uri=&quot;mock:xmlWithOptions&quot;/&gt;
 &lt;/route&gt;
 ]]></script>
-</div></div><p>Enabling XML DSL autocompletion for this component is easy: just refer to the appropriate <a shape="rect" class="external-link" href="http://camel.apache.org/xml-reference.html">Schema locations</a>, depending on whether you're using <a shape="rect" class="external-link" href="http://camel.apache.org/schema/spring/">Spring</a> or <a shape="rect" class="external-link" href="http://camel.apache.org/schema/blueprint/">Blueprint</a> DSL. Remember that this data format is available from Camel 2.10. Therefore only schemas from that version or later will include these new XML elements and attributes.</p><p>The syntax with <a shape="rect" href="using-osgi-blueprint-with-camel.html">Blueprint</a> is identical to that of the Spring DSL. Just ensure the correct namespaces and&#160;<strong><code>schemaLocations</code></strong> are in use.</p><h3 id="XmlJson-NamespaceMappings">Namespace Mappings</h3><p>XML has namespaces to fully qualify elements and attributes; JSON doesn't. You 
 need to take this into account when performing XML-JSON conversions.</p><p>To bridge the gap, <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/" rel="nofollow">Json-lib</a> has an option to bind namespace declarations in the form of prefixes and namespace URIs to XML output elements while unmarshalling, e.g., converting from JSON to XML.</p><p>For example, provided the following JSON string:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Enabling XML DSL autocompletion for this component is easy: just refer to the appropriate <a shape="rect" class="external-link" href="http://camel.apache.org/xml-reference.html">Schema locations</a>, depending on whether you're using <a shape="rect" class="external-link" href="http://camel.apache.org/schema/spring/">Spring</a> or <a shape="rect" class="external-link" href="http://camel.apache.org/schema/blueprint/">Blueprint</a> DSL. Remember that this data format is available from Camel 2.10. Therefore only schemas from that version or later will include these new XML elements and attributes.</p><p>The syntax with <a shape="rect" href="using-osgi-blueprint-with-camel.html">Blueprint</a> is identical to that of the Spring DSL. Just ensure the correct namespaces and&#160;<strong><code>schemaLocations</code></strong> are in use.</p><h3 id="XmlJson-NamespaceMappings">Namespace Mappings</h3><p>XML has namespaces to fully qualify elements and attributes; JSON doesn't. You 
 need to take this into account when performing XML-JSON conversions.</p><p>To bridge the gap, <a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/" rel="nofollow">Json-lib</a> has an option to bind namespace declarations in the form of prefixes and namespace URIs to XML output elements while un-marshaling, e.g., converting from JSON to XML.</p><p>For example, provided the following JSON string:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[{ &quot;pref1:a&quot;: &quot;value1&quot;, &quot;pref2:b&quot;: &quot;value2&quot; }
 ]]></script>
 </div></div><p>you can ask&#160;<strong><code>json-lib</code></strong> to output namespace declarations on elements&#160;<strong><code>pref1:a</code></strong> and&#160;<strong><code>pref2:b</code></strong> to bind the prefixes&#160;<strong><code>pref1</code></strong> and&#160;<strong><code>pref2</code></strong> to specific namespace URIs.</p><p>To use this feature, simply create <strong><code>XmlJsonDataFormat.NamespacesPerElementMapping</code></strong> objects and add them to the <strong><code>namespaceMappings</code></strong> option (which is a <strong><code>List</code></strong>).</p><p>The <strong><code>XmlJsonDataFormat.NamespacesPerElementMapping</code></strong> holds an element name and a Map of <strong><code>[prefix =&gt; namespace URI]</code></strong>. To facilitate mapping multiple prefixes and namespace URIs, the <strong><code>NamespacesPerElementMapping(String element, String pipeSeparatedMappings)</code></strong> constructor takes a String-based pipe-separated sequence o
 f&#160;<strong><code>[prefix, namespaceURI]</code></strong> pairs in the following way: <strong><code>|ns2|http://camel.apache.org/personalData|ns3|http://camel.apache.org/personalData2|</code></strong>.</p><p>In order to define a default namespace, just leave the corresponding key field empty: <strong><code>|ns1|http://camel.apache.org/test1||http://camel.apache.org/default|</code>.</strong></p><p>Binding namespace declarations to an element name = empty string will attach those namespaces to the root element.</p><p>The code for this is:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">