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/08/25 08:22:03 UTC

svn commit: r1017260 [40/40] - in /websites/production/camel/content: ./ cache/

Modified: websites/production/camel/content/xpath.html
==============================================================================
--- websites/production/camel/content/xpath.html (original)
+++ websites/production/camel/content/xpath.html Fri Aug 25 08:22:01 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: XPath
@@ -86,283 +75,58 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="XPath-XPath">XPath</h2><p>Camel supports <a shape="rect" class="external-link" href="http://www.w3.org/TR/xpath" rel="nofollow">XPath</a> to allow an <a shape="rect" href="expression.html">Expression</a> or <a shape="rect" href="predicate.html">Predicate</a> to be used in the <a shape="rect" href="dsl.html">DSL</a> or <a shape="rect" href="xml-configuration.html">Xml Configuration</a>. For example you could use XPath to create an <a shape="rect" href="predicate.html">Predicate</a> in a <a shape="rect" href="message-filter.html">Message Filter</a> or as an <a shape="rect" href="expression.html">Expression</a> for a <a shape="rect" href="recipient-list.html">Recipient List</a>.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Streams</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If th
 e message body is stream based, which means the input is received by Camel as a stream, then you will only be able to read the content of the stream <strong>once</strong>. Oftentimes when using <a shape="rect" href="xpath.html">XPath</a> as <a shape="rect" href="message-filter.html">Message Filter</a> or <a shape="rect" href="content-based-router.html">Content Based Router</a> the data will be accessed multiple times. Therefore use <a shape="rect" href="stream-caching.html">Stream caching</a> or convert the message body to a <strong><code>String</code></strong> beforehand. This makes it safe to be re-read multiple times.</p></div></div><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[from(&quot;queue:foo&quot;)
-  .filter().xpath(&quot;//foo&quot;))
-  .to(&quot;queue:bar&quot;)
-]]></script>
-</div></div><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[from(&quot;queue:foo&quot;)
-  .choice().xpath(&quot;//foo&quot;)).to(&quot;queue:bar&quot;)
-  .otherwise().to(&quot;queue:others&quot;);
-]]></script>
-</div></div><h3 id="XPath-Namespaces">Namespaces</h3><p>You can easily use namespaces with XPath expressions using the Namespaces helper class.</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[
-Namespaces ns = new Namespaces(&quot;c&quot;, &quot;http://acme.com/cheese&quot;);
-
-from(&quot;direct:start&quot;).filter().
-        xpath(&quot;/c:person[@name=&#39;James&#39;]&quot;, ns).
-        to(&quot;mock:result&quot;);
-]]></script>
-</div></div><h3 id="XPath-Variables">Variables</h3><p>Variables in XPath is defined in different namespaces. The default namespace is <code><a shape="rect" class="external-link" href="http://camel.apache.org/schema/spring">http://camel.apache.org/schema/spring</a></code>.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Namespace URI</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Local part</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/in/">http://camel.apache.org/xml/in/</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Message</code></p></td><td colspan="1" rowspan="1" class="conflu
 enceTd"><p>The&#160;<strong><code>exchange.in</code></strong> message.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/out/">http://camel.apache.org/xml/out/</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Message</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The&#160;<strong><code>exchange.out</code></strong> message.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/function/">http://camel.apache.org/xml/function/</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>functions</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> Additional functions.</p></td></
 tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/variables/environment-variables">http://camel.apache.org/xml/variables/environment-variables</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>env</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Object</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>OS environment variables.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/variables/system-properties">http://camel.apache.org/xml/variables/system-properties</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>system</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Object</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Java System properties.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect
 " class="external-link" href="http://camel.apache.org/xml/variables/exchange-property">http://camel.apache.org/xml/variables/exchange-property</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The exchange property.</p></td></tr></tbody></table></div><p>Camel will resolve variables according to either:</p><ul class="alternate"><li>namespace given</li><li>no namespace given</li></ul><h4 id="XPath-NamespaceGiven">Namespace Given</h4><p>If the namespace is given then Camel is instructed exactly what to return. However when resolving either&#160;<strong><code>IN</code></strong> or&#160;<strong><code>OUT</code></strong> Camel will try to resolve a header with the given local part first, and return it. If the local part has the value&#160;<strong><code>body</code></strong> then the body is returned instead.</p><h4 id="XPath-NoNamespac
 eGiven">No Namespace Given</h4><p>If there is no namespace given then Camel resolves only based on the local part. Camel will try to resolve a variable in the following steps:</p><ul class="alternate"><li>From <strong><code>variables</code></strong> that has been set using the <strong><code>variable(name, value)</code></strong> fluent builder.</li><li>From&#160;<strong><code>message.in.header</code></strong> if there is a header with the given key.</li><li>From&#160;<strong><code>exchange.properties</code></strong> if there is a property with the given key.</li></ul><h3 id="XPath-Functions">Functions</h3><p>Camel adds the following XPath functions that can be used to access the exchange:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Function</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Argument</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
 class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in:body</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Will return the&#160;<strong><code>IN</code></strong> message body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in:header</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the header name</p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Object</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Will return the&#160;<strong><code>IN</code></strong> message header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out:body</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Objec
 t</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Will return the&#160;<strong><code>OUT</code></strong> message body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out:header</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the header name</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Will return the&#160;<strong><code>OUT</code></strong> message header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>function:properties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>key for property</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> To lookup a property using the <a shape="rect" href="properties.html">Properties</a> component (property placeholders).</p></td></tr
 ><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>function:simple</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>simple expression</p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Object</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> To evaluate a <a shape="rect" href="simple.html">Simple</a> expression.</p></td></tr></tbody></table></div><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><strong>Note: <code>function:properties</code></strong> and <strong><code>function:simple</code></strong> is not supported when the return type is a <strong><code>NodeSet</code></strong>, such as when using with a <a shape="rect" href="splitter.html">Splitter</a> EIP.</div></div><p>Here's an example showing some of these functions in us
 e.</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[
-from(&quot;direct:start&quot;).choice()
-  .when().xpath(&quot;in:header(&#39;foo&#39;) = &#39;bar&#39;&quot;).to(&quot;mock:x&quot;)
-  .when().xpath(&quot;in:body() = &#39;&lt;two/&gt;&#39;&quot;).to(&quot;mock:y&quot;)
-  .otherwise().to(&quot;mock:z&quot;);
-]]></script>
-</div></div>And the new functions introduced in Camel 2.5:<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[
-// setup properties component
-PropertiesComponent properties = new PropertiesComponent();
-properties.setLocation(&quot;classpath:org/apache/camel/builder/xml/myprop.properties&quot;);
-context.addComponent(&quot;properties&quot;, properties);
-
-// myprop.properties contains the following properties
-// foo=Camel
-// bar=Kong
-
-from(&quot;direct:in&quot;).choice()
-    // $type is a variable for the header with key type
-    // here we use the properties function to lookup foo from the properties files
-    // which at runtime will be evaluted to &#39;Camel&#39;
-    .when().xpath(&quot;$type = function:properties(&#39;foo&#39;)&quot;)
-        .to(&quot;mock:camel&quot;)
-    // here we use the simple language to evaluate the expression
-    // which at runtime will be evaluated to &#39;Donkey Kong&#39;
-    .when().xpath(&quot;//name = function:simple(&#39;Donkey ${properties:bar}&#39;)&quot;)
-        .to(&quot;mock:donkey&quot;)
-    .otherwise()
-        .to(&quot;mock:other&quot;)
-    .end();
-]]></script>
-</div></div><h3 id="XPath-UsingXMLConfiguration">Using XML Configuration</h3><p>If you prefer to configure your routes in your <a shape="rect" href="spring.html">Spring</a> XML file then you can use XPath expressions as follows</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
-       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xsi:schemaLocation=&quot;
+<div class="wiki-content maincontent"><h2 id="XPath-XPath">XPath</h2><p>Camel supports <a shape="rect" class="external-link" href="http://www.w3.org/TR/xpath" rel="nofollow">XPath</a> to allow an <a shape="rect" href="expression.html">Expression</a> or <a shape="rect" href="predicate.html">Predicate</a> to be used in the <a shape="rect" href="dsl.html">DSL</a> or <a shape="rect" href="xml-configuration.html">Xml Configuration</a>. For example you could use XPath to create an <a shape="rect" href="predicate.html">Predicate</a> in a <a shape="rect" href="message-filter.html">Message Filter</a> or as an <a shape="rect" href="expression.html">Expression</a> for a <a shape="rect" href="recipient-list.html">Recipient List</a>.</p><parameter ac:name="title">Streams</parameter><rich-text-body><p>If the message body is stream based, which means the input is received by Camel as a stream, then you will only be able to read the content of the stream <strong>once</strong>. Oftentimes when using
  <a shape="rect" href="xpath.html">XPath</a> as <a shape="rect" href="message-filter.html">Message Filter</a> or <a shape="rect" href="content-based-router.html">Content Based Router</a> the data will be accessed multiple times. Therefore use <a shape="rect" href="stream-caching.html">Stream caching</a> or convert the message body to a <strong><code>String</code></strong> beforehand. This makes it safe to be re-read multiple times.</p></rich-text-body><plain-text-body>from("queue:foo")
+  .filter().xpath("//foo"))
+  .to("queue:bar")
+</plain-text-body><plain-text-body>from("queue:foo")
+  .choice().xpath("//foo")).to("queue:bar")
+  .otherwise().to("queue:others");
+</plain-text-body><h3 id="XPath-Namespaces">Namespaces</h3><p>You can easily use namespaces with XPath expressions using the Namespaces helper class.<plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespacesFilterTest.java}</plain-text-body></p><h3 id="XPath-Variables">Variables</h3><p>Variables in XPath is defined in different namespaces. The default namespace is <code><a shape="rect" class="external-link" href="http://camel.apache.org/schema/spring">http://camel.apache.org/schema/spring</a></code>.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Namespace URI</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Local part</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a sha
 pe="rect" class="external-link" href="http://camel.apache.org/xml/in/">http://camel.apache.org/xml/in/</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Message</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The&#160;<strong><code>exchange.in</code></strong> message.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/out/">http://camel.apache.org/xml/out/</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Message</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The&#160;<strong><code>exchange.out</code></strong> message.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/function/">http://camel
 .apache.org/xml/function/</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>functions</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> Additional functions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/variables/environment-variables">http://camel.apache.org/xml/variables/environment-variables</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>env</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Object</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>OS environment variables.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/variables/system-properties">http://camel.apache.org/xml/variables/system-properties</a></td>
 <td colspan="1" rowspan="1" class="confluenceTd"><p><code>system</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Object</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Java System properties.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://camel.apache.org/xml/variables/exchange-property">http://camel.apache.org/xml/variables/exchange-property</a></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The exchange property.</p></td></tr></tbody></table></div><p>Camel will resolve variables according to either:</p><ul class="alternate"><li>namespace given</li><li>no namespace given</li></ul><h4 id="XPath-NamespaceGiven">Namespace Given</h4><p>If the namespace is given then Camel is instructed exactly what to return. However when resol
 ving either&#160;<strong><code>IN</code></strong> or&#160;<strong><code>OUT</code></strong> Camel will try to resolve a header with the given local part first, and return it. If the local part has the value&#160;<strong><code>body</code></strong> then the body is returned instead.</p><h4 id="XPath-NoNamespaceGiven">No Namespace Given</h4><p>If there is no namespace given then Camel resolves only based on the local part. Camel will try to resolve a variable in the following steps:</p><ul class="alternate"><li>From <strong><code>variables</code></strong> that has been set using the <strong><code>variable(name, value)</code></strong> fluent builder.</li><li>From&#160;<strong><code>message.in.header</code></strong> if there is a header with the given key.</li><li>From&#160;<strong><code>exchange.properties</code></strong> if there is a property with the given key.</li></ul><h3 id="XPath-Functions">Functions</h3><p>Camel adds the following XPath functions that can be used to access the e
 xchange:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Function</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Argument</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in:body</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Will return the&#160;<strong><code>IN</code></strong> message body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in:header</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the header name</p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Object</code></td><td colspan="1" rowspan="1" class="confl
 uenceTd"><p>Will return the&#160;<strong><code>IN</code></strong> message header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out:body</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Will return the&#160;<strong><code>OUT</code></strong> message body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out:header</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the header name</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Will return the&#160;<strong><code>OUT</code></strong> message header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>function:properties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>key for 
 property</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> To lookup a property using the <a shape="rect" href="properties.html">Properties</a> component (property placeholders).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>function:simple</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>simple expression</p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>Object</code></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> To evaluate a <a shape="rect" href="simple.html">Simple</a> expression.</p></td></tr></tbody></table></div><rich-text-body><strong>Note: <code>function:properties</code></strong> and <strong><code>function:simple</code></strong> is not supported when the return type is a <strong><code>NodeSet</code></strong>, such as when using with a <a shape="rect" href="spli
 tter.html">Splitter</a> EIP.</rich-text-body><p>Here's an example showing some of these functions in use.<plain-text-body>{snippet:id=ex|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathFunctionTest.java}</plain-text-body>And the new functions introduced in Camel 2.5:<plain-text-body>{snippet:id=ex|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathFunctionsTest.java}</plain-text-body></p><h3 id="XPath-UsingXMLConfiguration">Using XML Configuration</h3><p>If you prefer to configure your routes in your <a shape="rect" href="spring.html">Spring</a> XML file then you can use XPath expressions as follows</p><parameter ac:name="lang">xml</parameter><plain-text-body>&lt;beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd&quot;&gt;
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"&gt;
 
-  &lt;camelContext id=&quot;camel&quot; xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot; xmlns:foo=&quot;http://example.com/person&quot;&gt;
+  &lt;camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring" xmlns:foo="http://example.com/person"&gt;
     &lt;route&gt;
-      &lt;from uri=&quot;activemq:MyQueue&quot;/&gt;
+      &lt;from uri="activemq:MyQueue"/&gt;
       &lt;filter&gt;
-        &lt;xpath&gt;/foo:person[@name=&#39;James&#39;]&lt;/xpath&gt;
-        &lt;to uri=&quot;mqseries:SomeOtherQueue&quot;/&gt;
+        &lt;xpath&gt;/foo:person[@name='James']&lt;/xpath&gt;
+        &lt;to uri="mqseries:SomeOtherQueue"/&gt;
       &lt;/filter&gt;
     &lt;/route&gt;
   &lt;/camelContext&gt;
 &lt;/beans&gt;
-]]></script>
-</div></div><p>Notice how we can reuse the namespace prefixes,&#160;<strong><code>foo</code></strong> in this case, in the XPath expression for easier namespace based XPath expressions! See also this <a shape="rect" class="external-link" href="http://camel.465427.n5.nabble.com/fail-filter-XPATH-camel-td476424.html" rel="nofollow">discussion on the mailinglist</a> about using your own namespaces with XPath.</p><h3 id="XPath-SettingtheResultType">Setting the Result Type</h3><p>The <a shape="rect" href="xpath.html">XPath</a> expression will return a result type using native XML objects such as <strong><code>org.w3c.dom.NodeList</code></strong>. But many times you want a result type to be a <strong><code>String</code></strong>. To do this you have to instruct the <a shape="rect" href="xpath.html">XPath</a> which result type to use.</p><p>In Java DSL:</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[xpath(&quot;/foo:person/@id&quot;, String.class)
-]]></script>
-</div></div><p>In Spring DSL you use the&#160;<strong><code>resultType</code></strong> attribute to provide a fully qualified classname:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;xpath resultType=&quot;java.lang.String&quot;&gt;/foo:person/@id&lt;/xpath&gt;
-]]></script>
-</div></div><p>In <strong><code>@XPath</code></strong>:<br clear="none"> <strong>Available as of Camel 2.1</strong></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[@XPath(value = &quot;concat(&#39;foo-&#39;,//order/name/)&quot;, resultType = String.class) String name)
-]]></script>
-</div></div><p>Where we use the XPath function&#160;<strong><code>concat</code></strong> to prefix the order name with <strong><code>foo-</code></strong>. In this case we have to specify that we want a&#160;<strong><code>String</code></strong> as result type so the&#160;<strong><code>concat</code></strong> function works.</p><h3 id="XPath-UsingXPathonHeaders">Using XPath on Headers</h3><p><strong>Available as of Camel 2.11</strong></p><p>Some users may have XML stored in a header. To apply an XPath statement to a header's value you can do this by defining the&#160;<strong><code>headerName</code></strong> attribute.</p><p>In XML DSL:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;xpathHeaderNameTest&quot; xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt;
-  &lt;route&gt;
-    &lt;from uri=&quot;direct:in&quot;/&gt;
-    &lt;choice&gt;
-      &lt;when&gt;
-        &lt;!-- use headerName attribute to refer to a header --&gt;
-        &lt;xpath headerName=&quot;invoiceDetails&quot;&gt;/invoice/@orderType = &#39;premium&#39;&lt;/xpath&gt;
-        &lt;to uri=&quot;mock:premium&quot;/&gt;
-      &lt;/when&gt;
-      &lt;when&gt;
-        &lt;!-- use headerName attribute to refer to a header --&gt;
-        &lt;xpath headerName=&quot;invoiceDetails&quot;&gt;/invoice/@orderType = &#39;standard&#39;&lt;/xpath&gt;
-        &lt;to uri=&quot;mock:standard&quot;/&gt;
-      &lt;/when&gt;
-      &lt;otherwise&gt;
-        &lt;to uri=&quot;mock:unknown&quot;/&gt;
-      &lt;/otherwise&gt;
-    &lt;/choice&gt;
-  &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div>And in Java DSL you specify the&#160;<strong><code>headerName</code></strong> as the 2nd parameter as shown:<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[xpath(&quot;/invoice/@orderType = &#39;premium&#39;&quot;, &quot;invoiceDetails&quot;)
-]]></script>
-</div></div><h3 id="XPath-Examples">Examples</h3><p>Here is a simple <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathFilterTest.java">example</a> using an XPath expression as a predicate in a <a shape="rect" href="message-filter.html">Message Filter</a></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[
-from(&quot;direct:start&quot;).
-        filter().xpath(&quot;/person[@name=&#39;James&#39;]&quot;).
-        to(&quot;mock:result&quot;);
-]]></script>
-</div></div>If you have a standard set of namespaces you wish to work with and wish to share them across many different XPath expressions you can use the&#160;<strong><code>NamespaceBuilder</code></strong> as shown <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterTest.java">in this example</a><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[
-// lets define the namespaces we&#39;ll need in our filters
-Namespaces ns = new Namespaces(&quot;c&quot;, &quot;http://acme.com/cheese&quot;)
-        .add(&quot;xsd&quot;, &quot;http://www.w3.org/2001/XMLSchema&quot;);
-
-// now lets create an xpath based Message Filter
-from(&quot;direct:start&quot;).
-        filter(ns.xpath(&quot;/c:person[@name=&#39;James&#39;]&quot;)).
-        to(&quot;mock:result&quot;);
-]]></script>
-</div></div>In this sample we have a&#160;<strong><code>choice</code></strong> construct. The first choice evaulates if the message has a header key&#160;<strong><code>type</code></strong> that has the value <strong><code>Camel</code></strong>. The 2nd&#160;<strong><code>choice</code></strong> evaluates if the message body has a name tag&#160;<strong><code>&lt;name&gt;</code></strong> which values is <strong><code>Kong</code></strong>.<br clear="none"> If neither is true the message is routed in the otherwise block:<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[
-from(&quot;direct:in&quot;).choice()
-    // using $headerName is special notation in Camel to get the header key
-    .when().xpath(&quot;$type = &#39;Camel&#39;&quot;)
-        .to(&quot;mock:camel&quot;)
-    // here we test for the body name tag
-    .when().xpath(&quot;//name = &#39;Kong&#39;&quot;)
-        .to(&quot;mock:donkey&quot;)
-    .otherwise()
-        .to(&quot;mock:other&quot;)
-    .end();
-]]></script>
-</div></div>And the spring XML equivalent of the route:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:in&quot;/&gt;
-        &lt;choice&gt;
-            &lt;when&gt;
-                &lt;xpath&gt;$type = &#39;Camel&#39;&lt;/xpath&gt;
-                &lt;to uri=&quot;mock:camel&quot;/&gt;
-            &lt;/when&gt;
-            &lt;when&gt;
-                &lt;xpath&gt;//name = &#39;Kong&#39;&lt;/xpath&gt;
-                &lt;to uri=&quot;mock:donkey&quot;/&gt;
-            &lt;/when&gt;
-            &lt;otherwise&gt;
-                &lt;to uri=&quot;mock:other&quot;/&gt;
-            &lt;/otherwise&gt;
-        &lt;/choice&gt;
-    &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div><h2 id="XPath-XPathInjection">XPath Injection</h2><p>You can use <a shape="rect" href="bean-integration.html">Bean Integration</a> to invoke a method on a bean and use various languages such as XPath to extract a value from the message and bind it to a method parameter.</p><p>The default XPath annotation has SOAP and XML namespaces available. If you want to use your own namespace URIs in an XPath expression you can use your own copy of the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/language/XPath.html">XPath annotation</a> to create whatever namespace prefixes you want to use.</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[
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.w3c.dom.NodeList;
-
-import org.apache.camel.component.bean.XPathAnnotationExpressionFactory;
-import org.apache.camel.language.LanguageAnnotation;
-import org.apache.camel.language.NamespacePrefix;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
-@LanguageAnnotation(language = &quot;xpath&quot;, factory = XPathAnnotationExpressionFactory.class)
-public @interface MyXPath {
-    String value();
-
-    // You can add the namespaces as the default value of the annotation
-    NamespacePrefix[] namespaces() default {
-    @NamespacePrefix(prefix = &quot;n1&quot;, uri = &quot;http://example.org/ns1&quot;),
-    @NamespacePrefix(prefix = &quot;n2&quot;, uri = &quot;http://example.org/ns2&quot;)};
-
-    Class&lt;?&gt; resultType() default NodeList.class;
-}
-]]></script>
-</div></div>e.g., cut and paste upper code to your own project in a different package and/or annotation name then add whatever namespace prefix/URIs you want in scope when you use your annotation on a method parameter. Then when you use your annotation on a method parameter all the namespaces you want will be available for use in your XPath expression.<p>Example:</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[public class Foo {
+</plain-text-body><p>Notice how we can reuse the namespace prefixes,&#160;<strong><code>foo</code></strong> in this case, in the XPath expression for easier namespace based XPath expressions! See also this <a shape="rect" class="external-link" href="http://camel.465427.n5.nabble.com/fail-filter-XPATH-camel-td476424.html" rel="nofollow">discussion on the mailinglist</a> about using your own namespaces with XPath.</p><h3 id="XPath-SettingtheResultType">Setting the Result Type</h3><p>The <a shape="rect" href="xpath.html">XPath</a> expression will return a result type using native XML objects such as <strong><code>org.w3c.dom.NodeList</code></strong>. But many times you want a result type to be a <strong><code>String</code></strong>. To do this you have to instruct the <a shape="rect" href="xpath.html">XPath</a> which result type to use.</p><p>In Java DSL:</p><parameter ac:name="language">java</parameter><plain-text-body>xpath("/foo:person/@id", String.class)
+</plain-text-body><p>In Spring DSL you use the&#160;<strong><code>resultType</code></strong> attribute to provide a fully qualified classname:</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;xpath resultType="java.lang.String"&gt;/foo:person/@id&lt;/xpath&gt;
+</plain-text-body><p>In <strong><code>@XPath</code></strong>:<br clear="none"> <strong>Available as of Camel 2.1</strong></p><parameter ac:name="language">java</parameter><plain-text-body>@XPath(value = "concat('foo-',//order/name/)", resultType = String.class) String name)
+</plain-text-body><p>Where we use the XPath function&#160;<strong><code>concat</code></strong> to prefix the order name with <strong><code>foo-</code></strong>. In this case we have to specify that we want a&#160;<strong><code>String</code></strong> as result type so the&#160;<strong><code>concat</code></strong> function works.</p><h3 id="XPath-UsingXPathonHeaders">Using XPath on Headers</h3><p><strong>Available as of Camel 2.11</strong></p><p>Some users may have XML stored in a header. To apply an XPath statement to a header's value you can do this by defining the&#160;<strong><code>headerName</code></strong> attribute.</p><p>In XML DSL:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/XPathHeaderNameTest.xml}</plain-text-body>And in Java DSL you specify the&#160;<strong><code>headerName</code></strong> as the 2nd parameter as shown:</p><parameter ac:name="language">java</parameter><plai
 n-text-body>xpath("/invoice/@orderType = 'premium'", "invoiceDetails")
+</plain-text-body><h3 id="XPath-Examples">Examples</h3><p>Here is a simple <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathFilterTest.java">example</a> using an XPath expression as a predicate in a <a shape="rect" href="message-filter.html">Message Filter</a><plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathFilterTest.java}</plain-text-body>If you have a standard set of namespaces you wish to work with and wish to share them across many different XPath expressions you can use the&#160;<strong><code>NamespaceBuilder</code></strong> as shown <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterTest.java">in this example</a><plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/camel-core/src/test/
 java/org/apache/camel/processor/XPathWithNamespaceBuilderFilterTest.java}</plain-text-body>In this sample we have a&#160;<strong><code>choice</code></strong> construct. The first choice evaulates if the message has a header key&#160;<strong><code>type</code></strong> that has the value <strong><code>Camel</code></strong>. The 2nd&#160;<strong><code>choice</code></strong> evaluates if the message body has a name tag&#160;<strong><code>&lt;name&gt;</code></strong> which values is <strong><code>Kong</code></strong>.<br clear="none"> If neither is true the message is routed in the otherwise block:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xml/XPathHeaderTest.java}</plain-text-body>And the spring XML equivalent of the route:<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringXPathHeaderTest-context.xml}</plain-text-body></p><h2 id="
 XPath-XPathInjection">XPath Injection</h2><p>You can use <a shape="rect" href="bean-integration.html">Bean Integration</a> to invoke a method on a bean and use various languages such as XPath to extract a value from the message and bind it to a method parameter.</p><p>The default XPath annotation has SOAP and XML namespaces available. If you want to use your own namespace URIs in an XPath expression you can use your own copy of the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/language/XPath.html">XPath annotation</a> to create whatever namespace prefixes you want to use.<plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/component/xslt/MyXPath.java}</plain-text-body>e.g., cut and paste upper code to your own project in a different package and/or annotation name then add whatever namespace prefix/URIs you want in scope when you use your annotation on a method 
 parameter. Then when you use your annotation on a method parameter all the namespaces you want will be available for use in your XPath expression.</p><p>Example:</p><parameter ac:name="language">java</parameter><plain-text-body>public class Foo {
 	
-    @MessageDriven(uri = &quot;activemq:my.queue&quot;)
-    public void doSomething(@MyXPath(&quot;/ns1:foo/ns2:bar/text()&quot;) String correlationID, @Body String body) {
+    @MessageDriven(uri = "activemq:my.queue")
+    public void doSomething(@MyXPath("/ns1:foo/ns2:bar/text()") String correlationID, @Body String body) {
 		// process the inbound message here
     }
 }
-]]></script>
-</div></div><h3 id="XPath-UsingXPathBuilderWithoutanExchange">Using XPathBuilder Without an Exchange</h3><p><strong>Available as of Camel 2.3</strong></p><p>You can now use the <strong><code>org.apache.camel.builder.XPathBuilder</code></strong> without the need for an <a shape="rect" href="exchange.html">Exchange</a>. This comes handy if you want to use it as a helper to do custom XPath evaluations. It requires that you pass in a <a shape="rect" href="camelcontext.html">CamelContext</a> since a lot of the moving parts inside the&#160;<strong><code>XPathBuilder</code></strong> requires access to the Camel <a shape="rect" href="type-converter.html">Type Converter</a> and hence why <a shape="rect" href="camelcontext.html">CamelContext</a> is needed.</p><p>For example you can do something like this:</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[boolean matches = XPathBuilder.xpath(&quot;/foo/bar/@xyz&quot;).matches(context, &quot;&lt;foo&gt;&lt;bar xyz=&#39;cheese&#39;/&gt;&lt;/foo&gt;&quot;));
-]]></script>
-</div></div><p>This will match the given predicate.</p><p>You can also evaluate for example as shown in the following three examples:</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[String name = XPathBuilder.xpath(&quot;foo/bar&quot;).evaluate(context, &quot;&lt;foo&gt;&lt;bar&gt;cheese&lt;/bar&gt;&lt;/foo&gt;&quot;, String.class);
-Integer number = XPathBuilder.xpath(&quot;foo/bar&quot;).evaluate(context, &quot;&lt;foo&gt;&lt;bar&gt;123&lt;/bar&gt;&lt;/foo&gt;&quot;, Integer.class);
-Boolean bool = XPathBuilder.xpath(&quot;foo/bar&quot;).evaluate(context, &quot;&lt;foo&gt;&lt;bar&gt;true&lt;/bar&gt;&lt;/foo&gt;&quot;, Boolean.class);
-]]></script>
-</div></div><p>Evaluating with a String result is a common requirement and thus you can do it a bit simpler:</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[    String name = XPathBuilder.xpath(&quot;foo/bar&quot;).evaluate(context, &quot;&lt;foo&gt;&lt;bar&gt;cheese&lt;/bar&gt;&lt;/foo&gt;&quot;);
-]]></script>
-</div></div><h3 id="XPath-UsingSaxonwithXPathBuilder">Using Saxon with XPathBuilder</h3><p><strong>Available as of Camel 2.3</strong></p><p>You need to add <strong><code>camel-saxon</code></strong> as dependency to your project. It's now easier to use <a shape="rect" class="external-link" href="http://saxon.sourceforge.net/" rel="nofollow">Saxon</a> with the&#160;<strong><code>XPathBuilder</code></strong> which can be done in several ways as shown below. Where as the latter ones are the easiest ones.</p><p>Using a factory</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[
-// create a Saxon factory
-XPathFactory fac = new net.sf.saxon.xpath.XPathFactoryImpl();
-
-// create a builder to evaluate the xpath using the saxon factory
-XPathBuilder builder = XPathBuilder.xpath(&quot;tokenize(/foo/bar, &#39;_&#39;)[2]&quot;).factory(fac);
-
-// evaluate as a String result
-String result = builder.evaluate(context, &quot;&lt;foo&gt;&lt;bar&gt;abc_def_ghi&lt;/bar&gt;&lt;/foo&gt;&quot;);
-assertEquals(&quot;def&quot;, result);
-]]></script>
-</div></div>Using the object model<strong><br clear="none"></strong><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[
-// create a builder to evaluate the xpath using saxon based on its object model uri
-XPathBuilder builder = XPathBuilder.xpath(&quot;tokenize(/foo/bar, &#39;_&#39;)[2]&quot;).objectModel(&quot;http://saxon.sf.net/jaxp/xpath/om&quot;);
-
-// evaluate as a String result
-String result = builder.evaluate(context, &quot;&lt;foo&gt;&lt;bar&gt;abc_def_ghi&lt;/bar&gt;&lt;/foo&gt;&quot;);
-assertEquals(&quot;def&quot;, result);
-]]></script>
-</div></div>The easy one<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[
-// create a builder to evaluate the xpath using saxon
-XPathBuilder builder = XPathBuilder.xpath(&quot;tokenize(/foo/bar, &#39;_&#39;)[2]&quot;).saxon();
-
-// evaluate as a String result
-String result = builder.evaluate(context, &quot;&lt;foo&gt;&lt;bar&gt;abc_def_ghi&lt;/bar&gt;&lt;/foo&gt;&quot;);
-assertEquals(&quot;def&quot;, result);
-]]></script>
-</div></div><h3 id="XPath-SettingaCustomXPathFactoryUsingSystemProperty">Setting a Custom XPathFactory Using System Property</h3><p><strong>Available as of Camel 2.3</strong></p><p>Camel now supports reading the <a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/xpath/XPathFactory.html#newInstance(java.lang.String)" rel="nofollow">JVM system property <code>javax.xml.xpath.XPathFactory</code></a> that can be used to set a custom&#160;<strong><code>XPathFactory</code></strong> to use.</p><p>This unit test shows how this can be done to use Saxon instead:</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[
-// set system property with the XPath factory to use which is Saxon 
-System.setProperty(XPathFactory.DEFAULT_PROPERTY_NAME + &quot;:&quot; + &quot;http://saxon.sf.net/jaxp/xpath/om&quot;, &quot;net.sf.saxon.xpath.XPathFactoryImpl&quot;);
-
-// create a builder to evaluate the xpath using saxon
-XPathBuilder builder = XPathBuilder.xpath(&quot;tokenize(/foo/bar, &#39;_&#39;)[2]&quot;);
-
-// evaluate as a String result
-String result = builder.evaluate(context, &quot;&lt;foo&gt;&lt;bar&gt;abc_def_ghi&lt;/bar&gt;&lt;/foo&gt;&quot;);
-assertEquals(&quot;def&quot;, result);
-]]></script>
-</div></div>Camel will log at <strong><code>INFO</code></strong> level if it uses a non default&#160;<strong><code>XPathFactory</code></strong> such as:<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[XPathBuilder  INFO  Using system property javax.xml.xpath.XPathFactory:http://saxon.sf.net/jaxp/xpath/om with value:
+</plain-text-body><h3 id="XPath-UsingXPathBuilderWithoutanExchange">Using XPathBuilder Without an Exchange</h3><p><strong>Available as of Camel 2.3</strong></p><p>You can now use the <strong><code>org.apache.camel.builder.XPathBuilder</code></strong> without the need for an <a shape="rect" href="exchange.html">Exchange</a>. This comes handy if you want to use it as a helper to do custom XPath evaluations. It requires that you pass in a <a shape="rect" href="camelcontext.html">CamelContext</a> since a lot of the moving parts inside the&#160;<strong><code>XPathBuilder</code></strong> requires access to the Camel <a shape="rect" href="type-converter.html">Type Converter</a> and hence why <a shape="rect" href="camelcontext.html">CamelContext</a> is needed.</p><p>For example you can do something like this:</p><parameter ac:name="language">java</parameter><plain-text-body>boolean matches = XPathBuilder.xpath("/foo/bar/@xyz").matches(context, "&lt;foo&gt;&lt;bar xyz='cheese'/&gt;&lt;/foo&g
 t;"));
+</plain-text-body><p>This will match the given predicate.</p><p>You can also evaluate for example as shown in the following three examples:</p><parameter ac:name="language">java</parameter><plain-text-body>String name = XPathBuilder.xpath("foo/bar").evaluate(context, "&lt;foo&gt;&lt;bar&gt;cheese&lt;/bar&gt;&lt;/foo&gt;", String.class);
+Integer number = XPathBuilder.xpath("foo/bar").evaluate(context, "&lt;foo&gt;&lt;bar&gt;123&lt;/bar&gt;&lt;/foo&gt;", Integer.class);
+Boolean bool = XPathBuilder.xpath("foo/bar").evaluate(context, "&lt;foo&gt;&lt;bar&gt;true&lt;/bar&gt;&lt;/foo&gt;", Boolean.class);
+</plain-text-body><p>Evaluating with a String result is a common requirement and thus you can do it a bit simpler:</p><plain-text-body>    String name = XPathBuilder.xpath("foo/bar").evaluate(context, "&lt;foo&gt;&lt;bar&gt;cheese&lt;/bar&gt;&lt;/foo&gt;");
+</plain-text-body><h3 id="XPath-UsingSaxonwithXPathBuilder">Using Saxon with XPathBuilder</h3><p><strong>Available as of Camel 2.3</strong></p><p>You need to add <strong><code>camel-saxon</code></strong> as dependency to your project. It's now easier to use <a shape="rect" class="external-link" href="http://saxon.sourceforge.net/" rel="nofollow">Saxon</a> with the&#160;<strong><code>XPathBuilder</code></strong> which can be done in several ways as shown below. Where as the latter ones are the easiest ones.</p><p>Using a factory<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java}</plain-text-body>Using the object model<strong><br clear="none"></strong><plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java}</plain-text-body>The easy one<plain-text-body>{snippet:id=e3|lang=java|url=camel/trunk/components/camel-sax
 on/src/test/java/org/apache/camel/builder/saxon/XPathTest.java}</plain-text-body></p><h3 id="XPath-SettingaCustomXPathFactoryUsingSystemProperty">Setting a Custom XPathFactory Using System Property</h3><p><strong>Available as of Camel 2.3</strong></p><p>Camel now supports reading the <a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/xpath/XPathFactory.html#newInstance(java.lang.String)" rel="nofollow">JVM system property <code>javax.xml.xpath.XPathFactory</code></a> that can be used to set a custom&#160;<strong><code>XPathFactory</code></strong> to use.</p><p>This unit test shows how this can be done to use Saxon instead:<plain-text-body>{snippet:id=e4|lang=java|url=camel/trunk/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java}</plain-text-body>Camel will log at <strong><code>INFO</code></strong> level if it uses a non default&#160;<strong><code>XPathFactory</code></strong> such as:</p><plain-text-body>XPat
 hBuilder  INFO  Using system property javax.xml.xpath.XPathFactory:http://saxon.sf.net/jaxp/xpath/om with value:
                     net.sf.saxon.xpath.XPathFactoryImpl when creating XPathFactory
-]]></script>
-</div></div><p>To use Apache Xerces you can configure the system property:</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[-Djavax.xml.xpath.XPathFactory=org.apache.xpath.jaxp.XPathFactoryImpl
-]]></script>
-</div></div><h3 id="XPath-EnablingSaxonfromSpringDSL">Enabling Saxon from Spring DSL</h3><p><strong>Available as of Camel 2.10</strong></p><p>Similarly to Java DSL, to enable Saxon from Spring DSL you have three options:</p><p>Specifying the factory</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;xpath factoryRef=&quot;saxonFactory&quot; resultType=&quot;java.lang.String&quot;&gt;current-dateTime()&lt;/xpath&gt;
-]]></script>
-</div></div><p>Specifying the object model</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;xpath objectModel=&quot;http://saxon.sf.net/jaxp/xpath/om&quot; resultType=&quot;java.lang.String&quot;&gt;current-dateTime()&lt;/xpath&gt;
-]]></script>
-</div></div><p>Shortcut</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;xpath saxon=&quot;true&quot; resultType=&quot;java.lang.String&quot;&gt;current-dateTime()&lt;/xpath&gt;
-]]></script>
-</div></div><h3 id="XPath-NamespaceAuditingtoAidDebugging">Namespace Auditing to Aid Debugging</h3><p><strong>Available as of Camel 2.10</strong></p><p>A large number of XPath-related issues that users frequently face are linked to the usage of namespaces. You may have some misalignment between the namespaces present in your message and those that your XPath expression is aware of or referencing. XPath predicates or expressions that are unable to locate the XML elements and attributes due to namespaces issues may simply look like "they are not working", when in reality all there is to it is a lack of namespace definition.</p><p>Namespaces in XML are completely necessary, and while we would love to simplify their usage by implementing some magic or voodoo to wire namespaces automatically, truth is that any action down this path would disagree with the standards and would greatly hinder interoperability.</p><p>Therefore, the utmost we can do is assist you in debugging such issues by a
 dding two new features to the XPath Expression Language and are thus accessible from both predicates and expressions.</p><h4 id="XPath-LoggingtheNamespaceContextofYourXPathExpression/Predicate">Logging the Namespace Context of Your XPath Expression/Predicate</h4><p>Every time a new XPath expression is created in the internal pool, Camel will log the namespace context of the expression under the <strong><code>org.apache.camel.builder.xml.XPathBuilder</code></strong> logger. Since Camel represents Namespace Contexts in a hierarchical fashion (parent-child relationships), the entire tree is output in a recursive manner with the following format:</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[[me: {prefix -&gt; namespace}, {prefix -&gt; namespace}], [parent: [me: {prefix -&gt; namespace}, {prefix -&gt; namespace}], [parent: [me: {prefix -&gt; namespace}]]]
-]]></script>
-</div></div><p>Any of these options can be used to activate this logging:</p><ol><li>Enable&#160;<strong><code>TRACE</code></strong> logging on the <strong><code>org.apache.camel.builder.xml.XPathBuilder</code></strong> logger, or some parent logger such as <strong><code>org.apache.camel</code></strong> or the root logger.</li><li>Enable the <strong><code>logNamespaces</code></strong> option as indicated in <a shape="rect" href="#XPath-AuditingNamespaces">Auditing Namespaces</a>, in which case the logging will occur on the&#160;<strong><code>INFO</code></strong> level.</li></ol><p><span class="confluence-anchor-link" id="XPath-AuditingNamespaces"></span></p><h4 id="XPath-Auditingnamespaces">Auditing namespaces</h4><p>Camel is able to discover and dump all namespaces present on every incoming message before evaluating an XPath expression, providing all the richness of information you need to help you analyse and pinpoint possible namespace issues. To achieve this, it in turn internal
 ly uses another specially tailored XPath expression to extract all namespace mappings that appear in the message, displaying the prefix and the full namespace URI(s) for each individual mapping.</p><p>Some points to take into account:</p><ul><li>The implicit XML namespace (xmlns:xml="http://www.w3.org/XML/1998/namespace") is suppressed from the output because it adds no value.</li><li>Default namespaces are listed under the&#160;<strong><code>DEFAULT</code></strong> keyword in the output.</li><li>Keep in mind that namespaces can be remapped under different scopes. Think of a top-level 'a' prefix which in inner elements can be assigned a different namespace, or the default namespace changing in inner scopes. For each discovered prefix, all associated URIs are listed.</li></ul><p>You can enable this option in Java DSL and Spring DSL.</p><p>Java DSL:</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[XPathBuilder.xpath(&quot;/foo:person/@id&quot;, String.class).logNamespaces()
-]]></script>
-</div></div><p>Spring DSL:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;xpath logNamespaces=&quot;true&quot; resultType=&quot;String&quot;&gt;/foo:person/@id&lt;/xpath&gt;
-]]></script>
-</div></div><p>The result of the auditing will be appear at the&#160;<strong><code>INFO</code></strong> level under the <strong><code>org.apache.camel.builder.xml.XPathBuilder</code></strong> logger and will look like the following:</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[2012-01-16 13:23:45,878 [stSaxonWithFlag] INFO  XPathBuilder  - Namespaces discovered in message: 
+</plain-text-body><p>To use Apache Xerces you can configure the system property:</p><plain-text-body>-Djavax.xml.xpath.XPathFactory=org.apache.xpath.jaxp.XPathFactoryImpl
+</plain-text-body><h3 id="XPath-EnablingSaxonfromSpringDSL">Enabling Saxon from Spring DSL</h3><p><strong>Available as of Camel 2.10</strong></p><p>Similarly to Java DSL, to enable Saxon from Spring DSL you have three options:</p><p>Specifying the factory</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;xpath factoryRef="saxonFactory" resultType="java.lang.String"&gt;current-dateTime()&lt;/xpath&gt;
+</plain-text-body><p>Specifying the object model</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;xpath objectModel="http://saxon.sf.net/jaxp/xpath/om" resultType="java.lang.String"&gt;current-dateTime()&lt;/xpath&gt;
+</plain-text-body><p>Shortcut</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;xpath saxon="true" resultType="java.lang.String"&gt;current-dateTime()&lt;/xpath&gt;
+</plain-text-body><h3 id="XPath-NamespaceAuditingtoAidDebugging">Namespace Auditing to Aid Debugging</h3><p><strong>Available as of Camel 2.10</strong></p><p>A large number of XPath-related issues that users frequently face are linked to the usage of namespaces. You may have some misalignment between the namespaces present in your message and those that your XPath expression is aware of or referencing. XPath predicates or expressions that are unable to locate the XML elements and attributes due to namespaces issues may simply look like "they are not working", when in reality all there is to it is a lack of namespace definition.</p><p>Namespaces in XML are completely necessary, and while we would love to simplify their usage by implementing some magic or voodoo to wire namespaces automatically, truth is that any action down this path would disagree with the standards and would greatly hinder interoperability.</p><p>Therefore, the utmost we can do is assist you in debugging such issue
 s by adding two new features to the XPath Expression Language and are thus accessible from both predicates and expressions.</p><h4 id="XPath-LoggingtheNamespaceContextofYourXPathExpression/Predicate">Logging the Namespace Context of Your XPath Expression/Predicate</h4><p>Every time a new XPath expression is created in the internal pool, Camel will log the namespace context of the expression under the <strong><code>org.apache.camel.builder.xml.XPathBuilder</code></strong> logger. Since Camel represents Namespace Contexts in a hierarchical fashion (parent-child relationships), the entire tree is output in a recursive manner with the following format:</p><plain-text-body>[me: {prefix -&gt; namespace}, {prefix -&gt; namespace}], [parent: [me: {prefix -&gt; namespace}, {prefix -&gt; namespace}], [parent: [me: {prefix -&gt; namespace}]]]
+</plain-text-body><p>Any of these options can be used to activate this logging:</p><ol><li>Enable&#160;<strong><code>TRACE</code></strong> logging on the <strong><code>org.apache.camel.builder.xml.XPathBuilder</code></strong> logger, or some parent logger such as <strong><code>org.apache.camel</code></strong> or the root logger.</li><li>Enable the <strong><code>logNamespaces</code></strong> option as indicated in <a shape="rect" href="#XPath-AuditingNamespaces">Auditing Namespaces</a>, in which case the logging will occur on the&#160;<strong><code>INFO</code></strong> level.</li></ol><p><parameter ac:name="">AuditingNamespaces</parameter></p><h4 id="XPath-Auditingnamespaces">Auditing namespaces</h4><p>Camel is able to discover and dump all namespaces present on every incoming message before evaluating an XPath expression, providing all the richness of information you need to help you analyse and pinpoint possible namespace issues. To achieve this, it in turn internally uses another 
 specially tailored XPath expression to extract all namespace mappings that appear in the message, displaying the prefix and the full namespace URI(s) for each individual mapping.</p><p>Some points to take into account:</p><ul><li>The implicit XML namespace (xmlns:xml="http://www.w3.org/XML/1998/namespace") is suppressed from the output because it adds no value.</li><li>Default namespaces are listed under the&#160;<strong><code>DEFAULT</code></strong> keyword in the output.</li><li>Keep in mind that namespaces can be remapped under different scopes. Think of a top-level 'a' prefix which in inner elements can be assigned a different namespace, or the default namespace changing in inner scopes. For each discovered prefix, all associated URIs are listed.</li></ul><p>You can enable this option in Java DSL and Spring DSL.</p><p>Java DSL:</p><parameter ac:name="">java</parameter><plain-text-body>XPathBuilder.xpath("/foo:person/@id", String.class).logNamespaces()
+</plain-text-body><p>Spring DSL:</p><parameter ac:name="">xml</parameter><plain-text-body>&lt;xpath logNamespaces="true" resultType="String"&gt;/foo:person/@id&lt;/xpath&gt;
+</plain-text-body><p>The result of the auditing will be appear at the&#160;<strong><code>INFO</code></strong> level under the <strong><code>org.apache.camel.builder.xml.XPathBuilder</code></strong> logger and will look like the following:</p><plain-text-body>2012-01-16 13:23:45,878 [stSaxonWithFlag] INFO  XPathBuilder  - Namespaces discovered in message: 
 {xmlns:a=[http://apache.org/camel], DEFAULT=[http://apache.org/default], 
 xmlns:b=[http://apache.org/camelA, http://apache.org/camelB]}
-]]></script>
-</div></div><h3 id="XPath-LoadingScriptfromExternalResource">Loading Script from External Resource</h3><p><strong>Available as of Camel 2.11</strong></p><p>You can externalize the script and have Camel load it from a resource such as: <strong><code>classpath:</code></strong>, <code><strong>file:</strong></code> or <code><strong>http:</strong></code>.<br clear="none"> This is done using the following syntax: <code><strong>resource:scheme:location</strong></code>, e.g., to refer to a file on the classpath you can do:</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[.setHeader(&quot;myHeader&quot;).xpath(&quot;resource:classpath:myxpath.txt&quot;, String.class)
-]]></script>
-</div></div><h3 id="XPath-Dependencies">Dependencies</h3><p>The XPath language is part of camel-core.</p></div>
+</plain-text-body><h3 id="XPath-LoadingScriptfromExternalResource">Loading Script from External Resource</h3><p><strong>Available as of Camel 2.11</strong></p><p>You can externalize the script and have Camel load it from a resource such as: <strong><code>classpath:</code></strong>, <code><strong>file:</strong></code> or <code><strong>http:</strong></code>.<br clear="none"> This is done using the following syntax: <code><strong>resource:scheme:location</strong></code>, e.g., to refer to a file on the classpath you can do:</p><plain-text-body>.setHeader("myHeader").xpath("resource:classpath:myxpath.txt", String.class)
+</plain-text-body><h3 id="XPath-Dependencies">Dependencies</h3><p>The XPath language is part of camel-core.</p></div>
         </td>
         <td valign="top">
           <div class="navigation">

Modified: websites/production/camel/content/xstream.html
==============================================================================
--- websites/production/camel/content/xstream.html (original)
+++ websites/production/camel/content/xstream.html Fri Aug 25 08:22:01 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: XStream
@@ -86,69 +75,35 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="XStream-XStream">XStream</h2><p>XStream is a <a shape="rect" href="data-format.html">Data Format</a> which uses the <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> to marshal and unmarshal Java objects to and from XML.</p><p>To use XStream in your camel routes you need to add the a dependency on&#160;<strong>camel-xstream</strong>&#160;which implements this data format.</p><p>Maven users will need to add the following dependency to their <code>pom.xml</code>&#160;for this component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+<div class="wiki-content maincontent"><h2 id="XStream-XStream">XStream</h2><p>XStream is a <a shape="rect" href="data-format.html">Data Format</a> which uses the <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> to marshal and unmarshal Java objects to and from XML.</p><p>To use XStream in your camel routes you need to add the a dependency on&#160;<strong>camel-xstream</strong>&#160;which implements this data format.</p><p>Maven users will need to add the following dependency to their <code>pom.xml</code>&#160;for this component:</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-xstream&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
   &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div><h3 id="XStream-UsingtheJavaDSL">Using the Java DSL</h3><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[// lets turn Object messages into XML then send to MQSeries
-from(&quot;activemq:My.Queue&quot;).
+</plain-text-body><h3 id="XStream-UsingtheJavaDSL">Using the Java DSL</h3><plain-text-body>// lets turn Object messages into XML then send to MQSeries
+from("activemq:My.Queue").
   marshal().xstream().
-  to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><p>If you would like to configure the <code>XStream</code> instance used by the Camel for the message transformation, you can simply pass a reference to that instance on the DSL level.</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[XStream xStream = new XStream();
-xStream.aliasField(&quot;money&quot;, PurchaseOrder.class, &quot;cash&quot;);
+  to("mqseries:Another.Queue");
+</plain-text-body><p>If you would like to configure the <code>XStream</code> instance used by the Camel for the message transformation, you can simply pass a reference to that instance on the DSL level.</p><plain-text-body>XStream xStream = new XStream();
+xStream.aliasField("money", PurchaseOrder.class, "cash");
 // new Added setModel option since Camel 2.14
-xStream.setModel(&quot;NO_REFERENCES&quot;);
+xStream.setModel("NO_REFERENCES");
 ...
 
-from(&quot;direct:marshal&quot;).
+from("direct:marshal").
   marshal(new XStreamDataFormat(xStream)).
-  to(&quot;mock:marshaled&quot;);
-]]></script>
-</div></div><h3 id="XStream-XMLInputFactoryandXMLOutputFactory">XMLInputFactory and XMLOutputFactory</h3><p><a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">The XStream library</a> uses the <code>javax.xml.stream.XMLInputFactory</code> and <code>javax.xml.stream.XMLOutputFactory</code>, you can control which implementation of this factory should be used.</p><p>The Factory is discovered using this algorithm:<br clear="none"> 1. Use the <code>javax.xml.stream.XMLInputFactory</code> , <code>javax.xml.stream.XMLOutputFactory</code> system property.<br clear="none"> 2. Use the <code>lib/xml.stream.properties</code> file in the <code>JRE_HOME</code> directory.<br clear="none"> 3. Use the Services API, if available, to determine the classname by looking in the <code>META-INF/services/javax.xml.stream.XMLInputFactory</code>, <code>META-INF/services/javax.xml.stream.XMLOutputFactory</code> files in jars available to the JRE.<br clear="none"> 4. Use the
  platform default XMLInputFactory,XMLOutputFactory instance.</p><h3 id="XStream-HowtosettheXMLencodinginXstreamDataFormat?">How to set the XML encoding in Xstream DataFormat?</h3><p>From Camel 2.2.0, you can set the encoding of XML in Xstream DataFormat by setting the Exchange's property with the key <code>Exchange.CHARSET_NAME</code>, or setting the encoding property on Xstream from DSL or Spring config.</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[from(&quot;activemq:My.Queue&quot;).
-  marshal().xstream(&quot;UTF-8&quot;).
-  to(&quot;mqseries:Another.Queue&quot;);
-]]></script>
-</div></div><p></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel&quot; xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    
-    &lt;!-- we define the json xstream data formats to be used (xstream is default) --&gt;
-    &lt;dataFormats&gt;
-        &lt;xstream id=&quot;xstream-utf8&quot; encoding=&quot;UTF-8&quot; permissions=&quot;org.apache.camel.dataformat.stream.*&quot;/&gt;
-        &lt;xstream id=&quot;xstream-default&quot; permissions=&quot;org.apache.camel.dataformat.stream.*&quot;/&gt;
-    &lt;/dataFormats&gt;
-
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:in&quot;/&gt;
-        &lt;marshal ref=&quot;xstream-default&quot;/&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
-    &lt;/route&gt;
-
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:in-UTF-8&quot;/&gt;
-        &lt;marshal ref=&quot;xstream-utf8&quot;/&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
-    &lt;/route&gt;
-
-&lt;/camelContext&gt;
-]]></script>
-</div></div><h3 id="XStream-SettingthetypepermissionsofXstreamDataFormat">Setting the type permissions of Xstream DataFormat</h3><p>In Camel, one can always use its own processing step in the route to filter and block certain XML documents to be routed to the XStream's unmarhall step. From Camel 2.16.1, 2.15.5, you can set&#160;<a shape="rect" class="external-link" href="http://x-stream.github.io/security.html" rel="nofollow">XStream's type permissions</a>&#160;to automatically allow or deny the instantiation of certain types.</p><p>The default type permissions setting used by Camel denies all types except for those from java.lang and java.util packages. This setting can be changed by setting System property org.apache.camel.xstream.permissions. Its value is a string of comma-separated permission terms, each representing a type being allowed or denied, depending on whether the term is prefixed with '+' (note '+' may be omitted) or with '-', respectively.</p><p>Each term may contain 
 a wildcard character '*'. For example, value "-*,java.lang.*,java.util.*" indicates denying all types except for java.lang.* and java.util.* classes. Setting this value to an empty string "" reverts to the default XStream's type permissions handling which denies certain blacklisted classes and allow others.</p><p>The type permissions setting can be extended at an individual XStream DataFormat instance by setting its type permissions property.</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[    &lt;dataFormats&gt;
-        &lt;xstream id=&quot;xstream-default&quot; 
-                 permissions=&quot;org.apache.camel.samples.xstream.*&quot;/&gt;
+  to("mock:marshaled");
+</plain-text-body><h3 id="XStream-XMLInputFactoryandXMLOutputFactory">XMLInputFactory and XMLOutputFactory</h3><p><a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">The XStream library</a> uses the <code>javax.xml.stream.XMLInputFactory</code> and <code>javax.xml.stream.XMLOutputFactory</code>, you can control which implementation of this factory should be used.</p><p>The Factory is discovered using this algorithm:<br clear="none"> 1. Use the <code>javax.xml.stream.XMLInputFactory</code> , <code>javax.xml.stream.XMLOutputFactory</code> system property.<br clear="none"> 2. Use the <code>lib/xml.stream.properties</code> file in the <code>JRE_HOME</code> directory.<br clear="none"> 3. Use the Services API, if available, to determine the classname by looking in the <code>META-INF/services/javax.xml.stream.XMLInputFactory</code>, <code>META-INF/services/javax.xml.stream.XMLOutputFactory</code> files in jars available to the JRE.<br clear="none"> 4. U
 se the platform default XMLInputFactory,XMLOutputFactory instance.</p><h3 id="XStream-HowtosettheXMLencodinginXstreamDataFormat?">How to set the XML encoding in Xstream DataFormat?</h3><p>From Camel 2.2.0, you can set the encoding of XML in Xstream DataFormat by setting the Exchange's property with the key <code>Exchange.CHARSET_NAME</code>, or setting the encoding property on Xstream from DSL or Spring config.</p><plain-text-body>from("activemq:My.Queue").
+  marshal().xstream("UTF-8").
+  to("mqseries:Another.Queue");
+</plain-text-body><p><plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-xstream/src/test/resources/org/apache/camel/dataformat/xstream/SpringMarshalListTest.xml}</plain-text-body></p><h3 id="XStream-SettingthetypepermissionsofXstreamDataFormat">Setting the type permissions of Xstream DataFormat</h3><p>In Camel, one can always use its own processing step in the route to filter and block certain XML documents to be routed to the XStream's unmarhall step. From Camel 2.16.1, 2.15.5, you can set&#160;<a shape="rect" class="external-link" href="http://x-stream.github.io/security.html" rel="nofollow">XStream's type permissions</a>&#160;to automatically allow or deny the instantiation of certain types.</p><p>The default type permissions setting used by Camel denies all types except for those from java.lang and java.util packages. This setting can be changed by setting System property org.apache.camel.xstream.permissions. Its value is a string of comma-separated permis
 sion terms, each representing a type being allowed or denied, depending on whether the term is prefixed with '+' (note '+' may be omitted) or with '-', respectively.</p><p>Each term may contain a wildcard character '*'. For example, value "-*,java.lang.*,java.util.*" indicates denying all types except for java.lang.* and java.util.* classes. Setting this value to an empty string "" reverts to the default XStream's type permissions handling which denies certain blacklisted classes and allow others.</p><p>The type permissions setting can be extended at an individual XStream DataFormat instance by setting its type permissions property.</p><plain-text-body>    &lt;dataFormats&gt;
+        &lt;xstream id="xstream-default" 
+                 permissions="org.apache.camel.samples.xstream.*"/&gt;
         ...
 
 
-]]></script>
-</div></div></div>
+</plain-text-body></div>
         </td>
         <td valign="top">
           <div class="navigation">