Author: buildbot Date: Thu Feb 12 07:19:09 2015 New Revision: 939906 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 Thu Feb 12 07:19:09 2015 @@ -85,14 +85,7 @@ <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 => converting from XML to JSON</li><li>unmarshalling => 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 (*) are determined by json-lib, rather than the code of the data format itself. They are reflected here for convenience so that you don't have to dot back and forth with the json-lib docs.</p><div class="confluenceTableSmall"> -<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Name </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> UTF-8 (*) </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> 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>XMLSerializer.write()</code></a> method, hence it is only used when >producing XML. <br clear="none" class="atl-forced-newline"> -When producing JSON, the encoding is determined by the input String being processed. If the conversion is performed on an InputStream, json-lib uses the platform's default encoding (e.g. determined by the <code>file.encoding</code> 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> 'e' (*) </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> Specifies the name of the XML elements representing each array element. 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> 'a' (*) </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> Specifies the name of the top-level XML element. <br clear="none" class="atl-forced-newline"> -For example, when converting <code>[1, 2, 3]</code>, it will be output by default as <code><a><e>1</e><e>2</e><e>3</e></a></code>. By setting this option or rootName, you can alter the name of element 'a'. </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> none (*) </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> When converting any JSON construct (object, array, null) to XML (unmarshalling), it specifies the name of the top-level element. <br clear="none" class="atl-forced-newline"> -If not set, json-lib will use <code>arrayName</code> or <code>objectName</code> (default value: 'o', at the current time it is not configurable in this data format). If set to 'root', the JSON string { 'x': 'value1', 'y' : 'value2' } would turn into <code><root><x>value1</x><y>value2</y></root></code>, otherwise the 'root' element would be named 'o'. </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> false (*) </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> According to the json-lib docs: "Flag to be tolerant to incomplete namespace prefixes." In most cases, json-lib automatically changes thi s 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<NamespacesPerElementMapping></code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> none </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> Binds namespace prefixes and URIs to specific JSON elements. <code>NamespacesPerElementMapping</code> is a wrapper around an element name + a Map of prefixes against URIs. <br clear="none" class="atl-forced-newline"> </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<String></code> </p></td><td colspan="1" rowspan="1" cl ass="confluenceTd"><p> none </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> 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, for example: { number: 1,2,3 }, normally converted to: <code><number><e>1</e><e>2</e><e>3</e></number></code> (where e can be modified by setting elementName), would instead translate to <code><number>1</number><number>2</number><number>3</number></code>, if "number" is set as an expandable property </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" c lass="confluenceTd"><p> YES </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> Adds type hints to the resulting XML to aid conversion back to JSON. 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. <code>TypeHintsEnum</code> comprises the following values, which lead to different combinations of the underlying XMLSerializer's <code>typeHintsEnabled</code> and <code>typeHintsCompatibility</code> flags: <br clear="none" class="atl-forced-newline"></p> -<ul><li><code>TypeHintsEnum.NO</code> => <code>typeHintsEnabled</code> = false</li><li><code>TypeHintsEnum.YES</code> =>  <code>typeHintsEnabled</code> = true,  <code>typeHintsCompatibility</code> = true</li><li><code>TypeHintsEnum.WITH_PREFIX</code> =>  <code>typeHintsEnabled</code> = true,  <code>typeHintsCompatibility</code> = false</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> false (*) </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>(XML to JSON conversion).</strong> Determines whether the resulting JSON will start off with a top-most element whose name matches the XML root element. If disabled, XML string <code><a><x>1</x><y>2</y></a></code> turns into { 'x: '1', 'y': '2' }. Otherwise, it turns into { 'a': { 'x: '1', 'y': '2' }}. </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> false (*) </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> (XML to JSON conversion).</strong> 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> false (*) </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> (XML to JSON conversion).</strong> 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</co de> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>Boolean</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> false (*) </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> (XML to JSON conversion).</strong> Signals whether namespaces should be ignored. By default they will be added to the JSON output using @xmlns 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> false (*) </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> (XML to JSON conversion).</strong> Removes the namespace prefi xes from XML qualified elements, so that the resulting JSON string does not contain them. </p></td></tr></tbody></table></div> -</div><h3 id="XmlJson-BasicUsagewithJavaDSL">Basic Usage with Java DSL</h3><h4 id="XmlJson-Explicitlyinstantiatingthedataformat">Explicitly instantiating the data format</h4><p>Just instantiate the XmlJsonDataFormat from package org.apache.camel.dataformat.xmljson. Make sure you have installed the <code>camel-xmljson</code> feature (if running on OSGi) or that you've included camel-xmljson-{version}.jar and its transitive dependencies in your classpath. Example initialization with a default configuration:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<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 => converting from XML to JSON</li><li>unmarshalling => 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 (*) are determined by json-lib, rather than the code of the data format itself. They are reflected here for convenience so that you don't have to dot back and forth with the json-lib docs.</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</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>UTF-8 (*)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><s trong>Used when</strong> <span style="color: rgb(0,128,0);"><strong>unmarshalling</strong></span> <strong>(JSON to XML conversion).</strong> 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>XMLSerializer.write()</code></a> method, hence it is only used when producing XML. <br clear="none" class="atl-forced-newline"> When producing JSON, the encoding is determined by the input String being processed. If the conversion is performed on an InputStream, json-lib uses the platform's default encoding (e.g. determined by the <code>file.encoding</code> 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>'e' (*)</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> Specifies the name of the XML elements representing each array element. 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>'a' (*)</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> Specifies the name of the top-level XML element. <br clear="none" class="atl-forced-newline"> For example, when converting&# 160;<code>[1, 2, 3]</code>, it will be output by default as <code><a><e>1</e><e>2</e><e>3</e></a></code>. By setting this option or rootName, you can alter the name of element 'a'.</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>none (*)</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> When converting any JSON construct (object, array, null) to XML (unmarshalling), it specifies the name of the top-level element. <br clear="none" class="atl-forced-newline"> If not set, json-lib will use <code>arrayName</code> or <code>objectName</code> (default value: 'o', at the current time it is not configurab le in this data format). If set to 'root', the JSON string { 'x': 'value1', 'y' : 'value2' } would turn into <code><root><x>value1</x><y>value2</y></root></code>, otherwise the 'root' element would be named 'o'.</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>false (*)</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> According to the json-lib docs: "Flag to be tolerant to incomplete namespace prefixes." In most cases, json-lib 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<NamespacesPerElementMapping></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</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> Binds namespace prefixes and URIs to specific JSON elements. <code>NamespacesPerElementMapping</code> 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<String></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</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> 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, for example: { number: 1,2,3 }, normally converted to: <code><number><e>1</e><e>2</e><e>3</e></number></code> (where e can be modified by setting elementName), would instead translate to <code><number>1</number><number>2</number><number>3</number></code>, if "number" is set as an expandable property</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>YES</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 convers ion).</strong> Adds type hints to the resulting XML to aid conversion back to JSON. 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. <code>TypeHintsEnum</code> comprises the following values, which lead to different combinations of the underlying XMLSerializer's <code>typeHintsEnabled</code> and <code>typeHintsCompatibility</code> flags:</p><ul><li><code>TypeHintsEnum.NO</code> => <code>typeHintsEnabled</code> = false</li><li><code>TypeHintsEnum.YES</code> =>  <code>typeHintsEnabled</code> = true,  <code>typeHintsCompatibility</code> = true</li><li><code>TypeHintsEnum.WITH_PREFIX</code> =>  <code>typeHintsEnabled</code> = true,  <code>typeHintsCompatibility</code> = false</li></ul></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>forceTopLevelObject</code></p></td><td cols pan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false (*)</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>(XML to JSON conversion).</strong> Determines whether the resulting JSON will start off with a top-most element whose name matches the XML root element. If disabled, XML string <code><a><x>1</x><y>2</y></a></code> turns into { 'x: '1', 'y': '2' }. Otherwise, it turns into { 'a': { 'x: '1', 'y': '2' }}.</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>false (*)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <spa n style="color: rgb(51,51,153);"><strong>marshalling</strong></span><strong> (XML to JSON conversion).</strong> 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>false (*)</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> (XML to JSON conversion).</strong> 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>false (*)</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> (XML to JSON conversion).</strong> Signals whether namespaces should be ignored. By default they will be added to the JSON output using @xmlns 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>false (*)</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> (XML to JSON conversion).</strong> 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-BasicUs agewithJavaDSL">Basic Usage with Java DSL</h3><h4 id="XmlJson-Explicitlyinstantiatingthedataformat">Explicitly instantiating the data format</h4><p>Just instantiate the XmlJsonDataFormat from package org.apache.camel.dataformat.xmljson. Make sure you have installed the <code>camel-xmljson</code> feature (if running on OSGi) or that you've included camel-xmljson-{version}.jar and its transitive dependencies in your classpath. Example initialization with a default configuration:</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[XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat(); ]]></script> </div></div><p>To tune the behaviour of the data format as per the options above, use the appropriate setters:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -181,7 +174,14 @@ namespacesFormat.setRootElement("pe <version>x.x.x</version> <!-- Use the same version as camel-core, but remember that this component is only available from 2.10 onwards --> </dependency> -]]></script> + +<!-- And also XOM must be included. XOM cannot be included by default due to an incompatible +license with ASF; so add this manually --> +<dependency> + <groupId>xom</groupId> + <artifactId>xom</artifactId> + <version>1.2.5</version> +</dependency>]]></script> </div></div><h3 id="XmlJson-SeeAlso">See Also</h3><ul><li><a shape="rect" href="data-format.html">Data Format</a></li><li><a shape="rect" class="external-link" href="http://json-lib.sourceforge.net/" rel="nofollow">json-lib</a></li></ul></div> </td> <td valign="top">