Author: buildbot
Date: Sat Nov 3 18:17:59 2012
New Revision: 837174
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 Sat Nov 3 18:17:59 2012
@@ -200,7 +200,7 @@ xmlJsonOptions.put(org.apache.camel.mode
</pre>
</div></div>
-<p>To enable autocompletion for this component, you must be referring to the
appropriate XML Schema files depending on whether <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> is being used.
Remember that this data format is only available from Camel 2.10 onwards.</p>
+<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"
title="Using OSGi blueprint with Camel">Blueprint</a> is identical to that of
the Spring DSL. Just ensure the correct namespaces and schemaLocations are in
use.</p>
@@ -208,13 +208,23 @@ xmlJsonOptions.put(org.apache.camel.mode
<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 attempt 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, if you have the JSON string { 'pref1:a': 'value1',
'pref2:b': 'value2 }, 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 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>
-<p>To use this feature, simply create
<tt>XmlJsonDataFormat.NamespacesPerElementMapping</tt> objects, one per element
to which you need to bind namespace declarations, and add them to the
<tt>namespaceMappings</tt> option (which is a <tt>List</tt>).<br clear="none">
-The <tt>XmlJsonDataFormat.NamespacesPerElementMapping</tt> holds an element
name and a Map of [prefix => namespace URI]. To facilitate mapping multiple
prefixes and namespace URIs, the <tt>NamespacesPerElementMapping(String
element, String pipeSeparatedMappings)</tt> constructor takes a String-based
pipe-separated sequence of [prefix, namespaceURI] pairs in the following way:
<tt>|ns2|http://camel.apache.org/personalData|ns3|http://camel.apache.org/personalData2|</tt>.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+{ 'pref1:a': 'value1', 'pref2:b': 'value2 }
+</pre>
+</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
<tt>XmlJsonDataFormat.NamespacesPerElementMapping</tt> objects and add them to
the <tt>namespaceMappings</tt> option (which is a <tt>List</tt>).</p>
+
+<p>The <tt>XmlJsonDataFormat.NamespacesPerElementMapping</tt> holds an element
name and a Map of [prefix => namespace URI]. To facilitate mapping multiple
prefixes and namespace URIs, the <tt>NamespacesPerElementMapping(String
element, String pipeSeparatedMappings)</tt> constructor takes a String-based
pipe-separated sequence of [prefix, namespaceURI] pairs in the following way:
<tt>|ns2|http://camel.apache.org/personalData|ns3|http://camel.apache.org/personalData2|</tt>.</p>
+
+<p>In order to define a default namespace, just leave the corresponding key
field empty:
<tt>|ns1|http://camel.apache.org/test1||http://camel.apache.org/default|</tt>.</p>
-<p>In order to define a default namespace, just leave the corresponding key
field empty:
<tt>|ns1|http://camel.apache.org/test1||http://camel.apache.org/default|</tt>.<br
clear="none">
-Binding namespace declarations to an element name = empty string will attach
those namespaces to the root element.</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>
@@ -222,9 +232,11 @@ Binding namespace declarations to an ele
<pre class="code-java">
XmlJsonDataFormat namespacesFormat = <span class="code-keyword">new</span>
XmlJsonDataFormat();
List<XmlJsonDataFormat.NamespacesPerElementMapping> namespaces = <span
class="code-keyword">new</span>
ArrayList<XmlJsonDataFormat.NamespacesPerElementMapping>();
-namespaces.add(<span class="code-keyword">new</span>
XmlJsonDataFormat.NamespacesPerElementMapping(<span class="code-quote">"",
"</span>|ns1|http:<span
class="code-comment">//camel.apache.org/test1||http://camel.apache.org/<span
class="code-keyword">default</span>|"));
-</span>namespaces.add(<span class="code-keyword">new</span>
XmlJsonDataFormat.NamespacesPerElementMapping(<span
class="code-quote">"surname"</span>, <span class="code-quote">"|ns2|http:<span
class="code-comment">//camel.apache.org/personalData|"</span> +
-</span> <span class="code-quote">"ns3|http:<span
class="code-comment">//camel.apache.org/personalData2|"</span>));
+namespaces.add(<span class="code-keyword">new</span> XmlJsonDataFormat.
+ NamespacesPerElementMapping(<span
class="code-quote">"", "</span>|ns1|http:<span
class="code-comment">//camel.apache.org/test1||http://camel.apache.org/<span
class="code-keyword">default</span>|"));
+</span>namespaces.add(<span class="code-keyword">new</span> XmlJsonDataFormat.
+ NamespacesPerElementMapping(<span
class="code-quote">"surname"</span>, <span class="code-quote">"|ns2|http:<span
class="code-comment">//camel.apache.org/personalData|"</span> +
+</span> <span class="code-quote">"ns3|http:<span
class="code-comment">//camel.apache.org/personalData2|"</span>));
</span>namespacesFormat.setNamespaceMappings(namespaces);
namespacesFormat.setRootElement(<span class="code-quote">"person"</span>);
</pre>