camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r918451 - in /websites/production/camel/content: cache/main.pageCache xmljson.html
Date Tue, 05 Aug 2014 11:17:58 GMT
Author: buildbot
Date: Tue Aug  5 11:17:58 2014
New Revision: 918451

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 Tue Aug  5 11:17:58 2014
@@ -86,46 +86,18 @@
 	<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 id="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="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 (*) 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">
 <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> <font color="#008000"><strong>unmarshalling</strong></font>
<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> <font color="#008000"><strong>unmarshalling</strong></font><strong>&#160;(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>
<font color="#008000"><strong>unmarshalling</strong></font><strong>&#160;(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>&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>.
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> <font color="#008000"><strong>unmarshalling</strong></font><strong>&#160;(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&#160;<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>&lt;root&gt;&lt;x&gt;value1&lt;/x&gt;&lt;y&gt;value2&lt;/y&gt;&lt;/root&gt;</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> <font color="#008000"><strong>unmarshalling</strong></font><strong>&#160;(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
run
 time 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> none
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Used
when</strong> <font color="#008000"><strong>unmarshalling</strong></font><strong>&#160;(JSON
to XML conversion).</strong> Binds namespace prefixes and URIs to specific JSON elements.&#160;<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&lt;String&gt;</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> non
 e </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Used
when</strong> <font color="#008000"><strong>unmarshalling</strong></font><strong>&#160;(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>&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>
(where e can be modified by setting elementName), would instead translate to <code>&lt;number&gt;1&lt;/number&gt;&lt;number&gt;2&lt;/number&gt;&lt;number&gt;3&lt;/number&gt;</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><t
 d colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Used when</strong>
<font color="#008000"><strong>unmarshalling</strong></font><strong>&#160;(JSON
to XML conversion).</strong> 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. <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> =&gt; <code>typeHintsEnabled</code>&#160;=
false</li><li><code>TypeHintsEnum.YES</code> =&gt;&#160;&#160;<code>typeHintsEnabled</code>
= true,&#160;&#160;<code>typeHintsCompatibility</code> = true</li><li><code>TypeHintsEnum.WITH_PREFIX</code>
=&gt;&#160;&#160;<code>typeHintsEnabled</code> = true,&#160;&#160;<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>
<font color="#333399"><strong>marshalling</strong></font> <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>&lt;a&gt;&lt;x&gt;1&lt;/x&gt;&lt;y&gt;2&lt;/y&gt;&lt;/a&gt;</code>
turns into&#160;{ 'x: '1', 'y': '2' }. Otherwise, it turns into&#160;{ 'a': {&#160;'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="conflu
 enceTd"><p> false (*) </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
<strong>Used when</strong> <font color="#333399"><strong>marshalling</strong></font><strong>&#160;(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&#160;(*)
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Used
when</strong> <font color="#333399"><strong>marshalling</strong></font><strong>&#160;(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" clas
 s="confluenceTd"><p> <code>Boolean</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> false&#160;(*) </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Used when</strong>
<font color="#333399"><strong>marshalling</strong></font><strong>&#160;(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&#160;(*)
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Used
when</strong> <font color="#333399"><strong>marshalling</strong></font><strong>&#160;(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>
-
-<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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();
+</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">
+<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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[XmlJsonDataFormat
xmlJsonFormat = new XmlJsonDataFormat();
 xmlJsonFormat.setEncoding(&quot;UTF-8&quot;);
 xmlJsonFormat.setForceTopLevelObject(true);
 xmlJsonFormat.setTrimSpaces(true);
@@ -134,37 +106,20 @@ xmlJsonFormat.setSkipNamespaces(true);
 xmlJsonFormat.setRemoveNamespacePrefixes(true);
 xmlJsonFormat.setExpandableProperties(Arrays.asList(&quot;d&quot;, &quot;e&quot;));
 ]]></script>
-</div></div>
-
-<p>Once you've instantiated the data format, the next step is to actually use the it
from within the <code>marshal()</code> and <code>unmarshal()</code>
DSL elements:</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 XML to JSON
+</div></div><p>Once you've instantiated the data format, the next step
is to actually use the it from within the <code>marshal()</code> and <code>unmarshal()</code>
DSL elements:</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 XML to JSON
 from(&quot;direct:marshal&quot;).marshal(xmlJsonFormat).to(&quot;mock:json&quot;);
 // from JSON to XML
 from(&quot;direct:unmarshal&quot;).unmarshal(xmlJsonFormat).to(&quot;mock:xml&quot;);
 ]]></script>
-</div></div>
-
-<h4 id="XmlJson-Definingthedataformatin-line">Defining the data format in-line</h4>
-
-<p>Alternatively, you can define the data format inline by using the <code>xmljson()</code>
DSL element.</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 XML to JSON - inline dataformat
+</div></div><h4 id="XmlJson-Definingthedataformatin-line">Defining the
data format in-line</h4><p>Alternatively, you can define the data format inline
by using the <code>xmljson()</code> DSL element.</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 XML to JSON - inline dataformat
 from(&quot;direct:marshalInline&quot;).marshal().xmljson().to(&quot;mock:jsonInline&quot;);
 // from JSON to XML - inline dataformat
 from(&quot;direct:unmarshalInline&quot;).unmarshal().xmljson().to(&quot;mock:xmlInline&quot;);
 ]]></script>
-</div></div>
-
-<p>If you wish, you can even pass in a Map&lt;String, String&gt; to the inline
methods to provide custom options:</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[
-Map&lt;String, String&gt; xmlJsonOptions = new HashMap&lt;String, String&gt;();
+</div></div><p>If you wish, you can even pass in a Map&lt;String, String&gt;
to the inline methods to provide custom options:</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[Map&lt;String,
String&gt; xmlJsonOptions = new HashMap&lt;String, String&gt;();
 xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.ENCODING, &quot;UTF-8&quot;);
 xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.ROOT_NAME, &quot;newRoot&quot;);
 xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.SKIP_NAMESPACES, &quot;true&quot;);
@@ -176,27 +131,15 @@ from(&quot;direct:marshalInlineOptions&q
 // form JSON to XML - inline dataformat w/ options
 from(&quot;direct:unmarshalInlineOptions&quot;).unmarshal().xmljson(xmlJsonOptions).to(&quot;mock:xmlInlineOptions&quot;);
 ]]></script>
-</div></div>
-
-<h3 id="XmlJson-BasicusagewithSpringorBlueprintDSL">Basic usage with Spring or Blueprint
DSL</h3>
-
-<p>Within the <code>&lt;dataFormats&gt;</code> block, simply configure
an <code>xmljson</code> element with unique IDs:</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[
-&lt;dataFormats&gt;
+</div></div><h3 id="XmlJson-BasicusagewithSpringorBlueprintDSL">Basic usage
with Spring or Blueprint DSL</h3><p>Within the <code>&lt;dataFormats&gt;</code>
block, simply configure an <code>xmljson</code> element with unique IDs:</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[&lt;dataFormats&gt;
     &lt;xmljson id=&quot;xmljson&quot;/&gt;
     &lt;xmljson id=&quot;xmljsonWithOptions&quot; forceTopLevelObject=&quot;true&quot;
trimSpaces=&quot;true&quot; rootName=&quot;newRoot&quot; skipNamespaces=&quot;true&quot;

              removeNamespacePrefixes=&quot;true&quot; expandableProperties=&quot;d
e&quot;/&gt;
 &lt;/dataFormats&gt;
 ]]></script>
-</div></div>
-
-<p>Then you simply refer to the data format object within your <code>&lt;marshal
/&gt;</code> and {&lt;unmarshal /&gt;}} DSLs:</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[
-&lt;route&gt;
+</div></div><p>Then you simply refer to the data format object within your
<code>&lt;marshal /&gt;</code> and {&lt;unmarshal /&gt;}} DSLs:</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[&lt;route&gt;
     &lt;from uri=&quot;direct:marshal&quot;/&gt;
     &lt;marshal ref=&quot;xmljson&quot;/&gt;
     &lt;to uri=&quot;mock:json&quot; /&gt;
@@ -208,39 +151,11 @@ 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 onwards, so only schemas from that version onwards
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 schemaLocations
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 (i.e. converting
from JSON to XML). For example, provided the following JSON string:</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[
-{ &#39;pref1:a&#39;: &#39;value1&#39;, &#39;pref2:b&#39;: &#39;value2
}
+</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 onwards, so only schemas from that version onwards
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 schemaLocations 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 (i.e. converting from JSON to XML). For example, provided
the following JSON string:</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[{
&#39;pref1:a&#39;: &#39;value1&#39;, &#39;pref2:b&#39;: &#39;value2
}
 ]]></script>
-</div></div>
-
-<p>you can ask Json-lib to output namespace declarations on elements "pref1:a" and
"pref2:b" to bind the prefixes "pref1" and "pref2" to specific namespace URIs.</p>
-
-<p>To use this feature, simply create <code>XmlJsonDataFormat.NamespacesPerElementMapping</code>
objects and add them to the <code>namespaceMappings</code> option (which is a
<code>List</code>).</p>
-
-<p>The <code>XmlJsonDataFormat.NamespacesPerElementMapping</code> holds
an element name and a Map of [prefix =&gt; namespace URI]. To facilitate mapping multiple
prefixes and namespace URIs, the <code>NamespacesPerElementMapping(String element, String
pipeSeparatedMappings)</code> constructor takes a String-based pipe-separated sequence
of [prefix, namespaceURI] pairs in the following way: <code>|ns2|http://camel.apache.org/personalData|ns3|http://camel.apache.org/personalData2|</code>.</p>
-
-<p>In order to define a default namespace, just leave the corresponding key field empty:
<code>|ns1|http://camel.apache.org/test1||http://camel.apache.org/default|</code>.</p>
-
-<p>Binding namespace declarations to an element name = empty string will attach those
namespaces to the root element.</p>
-
-<p>The full code would look like that:</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 namespacesFormat = new XmlJsonDataFormat();
+</div></div><p>you can ask Json-lib to output namespace declarations on
elements "pref1:a" and "pref2:b" to bind the prefixes "pref1" and "pref2" to specific namespace
URIs.</p><p>To use this feature, simply create <code>XmlJsonDataFormat.NamespacesPerElementMapping</code>
objects and add them to the <code>namespaceMappings</code> option (which is a
<code>List</code>).</p><p>The <code>XmlJsonDataFormat.NamespacesPerElementMapping</code>
holds an element name and a Map of [prefix =&gt; namespace URI]. To facilitate mapping
multiple prefixes and namespace URIs, the <code>NamespacesPerElementMapping(String element,
String pipeSeparatedMappings)</code> constructor takes a String-based pipe-separated
sequence of [prefix, namespaceURI] pairs in the following way: <code>|ns2|http://camel.apache.org/personalData|ns3|http://camel.apache.org/personalData2|</code>.</p><p>In
order to define a default namespace, just leave the corresponding key field empty: <code>|ns1|http://camel.apache.org/tes
 t1||http://camel.apache.org/default|</code>.</p><p>Binding namespace declarations
to an element name = empty string will attach those namespaces to the root element.</p><p>The
full code would look like that:</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
namespacesFormat = new XmlJsonDataFormat();
 List&lt;XmlJsonDataFormat.NamespacesPerElementMapping&gt; namespaces = new ArrayList&lt;XmlJsonDataFormat.NamespacesPerElementMapping&gt;();
 namespaces.add(new XmlJsonDataFormat.
                        NamespacesPerElementMapping(&quot;&quot;, &quot;|ns1|http://camel.apache.org/test1||http://camel.apache.org/default|&quot;));
@@ -250,59 +165,25 @@ namespaces.add(new XmlJsonDataFormat.
 namespacesFormat.setNamespaceMappings(namespaces);
 namespacesFormat.setRootElement(&quot;person&quot;);
 ]]></script>
-</div></div>
-
-<p>And you can achieve the same in Spring DSL.</p>
-
-<h4 id="XmlJson-Example">Example</h4>
-
-<p>Using the namespace bindings in the Java snippet above on the following JSON string:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: javascript; gutter: false" type="syntaxhighlighter"><![CDATA[
-{ &quot;name&quot;: &quot;Raul&quot;, &quot;surname&quot;: &quot;Kripalani&quot;,
&quot;f&quot;: true, &quot;g&quot;: null}
-]]></script>
-</div></div>
-
-<p>Would yield the following XML:</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[
-&lt;person xmlns=&quot;http://camel.apache.org/default&quot; xmlns:ns1=&quot;http://camel.apache.org/test1&quot;&gt;
+</div></div><p>And you can achieve the same in Spring DSL.</p><h4
id="XmlJson-Example">Example</h4><p>Using the namespace bindings in the Java
snippet above on the following JSON string:</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[{
&quot;name&quot;: &quot;Raul&quot;, &quot;surname&quot;: &quot;Kripalani&quot;,
&quot;f&quot;: true, &quot;g&quot;: null}]]></script>
+</div></div><p>&#160;</p><p>Would yield the following XML:</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[&lt;person
xmlns=&quot;http://camel.apache.org/default&quot; xmlns:ns1=&quot;http://camel.apache.org/test1&quot;&gt;
     &lt;f&gt;true&lt;/f&gt;
     &lt;g null=&quot;true&quot;/&gt;
     &lt;name&gt;Raul&lt;/name&gt;
     &lt;surname xmlns:ns2=&quot;http://camel.apache.org/personalData&quot; xmlns:ns3=&quot;http://camel.apache.org/personalData2&quot;&gt;Kripalani&lt;/surname&gt;
 &lt;/person&gt;
 ]]></script>
-</div></div>
-
-<p>Remember that the JSON spec defines a JSON object as follows:</p>
-
-<blockquote>
-<p>An object is an unordered set of name/value pairs. [...].</p></blockquote>
-
-<p>That's why the elements are in a different order in the output XML.</p>
-
-<h3 id="XmlJson-Dependencies">Dependencies</h3>
-
-<p>To use the <a shape="rect" href="xmljson.html">XmlJson</a> dataformat
in your camel routes you need to add the following dependency to your pom.</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[
-&lt;dependency&gt;
+</div></div><p>Remember that the JSON spec defines a JSON object as follows:</p><blockquote><p>An
object is an unordered set of name/value pairs. [...].</p></blockquote><p>That's
why the elements are in a different order in the output XML.</p><h3 id="XmlJson-Dependencies">Dependencies</h3><p>To
use the <a shape="rect" href="xmljson.html">XmlJson</a> dataformat in your camel
routes you need to add the following dependency to your pom.</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[&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-xmljson&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
   &lt;!-- Use the same version as camel-core, but remember that this component is only
available from 2.10 onwards --&gt;
 &lt;/dependency&gt;
 ]]></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>
+</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">
           <div class="navigation">



Mime
View raw message