camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Jolliffe <bobjolli...@gmail.com>
Subject xpath and namespaces
Date Mon, 23 Apr 2012 16:23:27 GMT
I have an application where I load a camel context using spring and
then add different spring dsl routes particular to individual site
configurations.

I am having trouble using an XPath splitter because of the issue with
making namespaces visible to the XPath processor.

I've seen from here
(http://camel.465427.n5.nabble.com/fail-filter-XPATH-camel-td476424.html)
that if the route is defined within a camel context, then you can make
the namespace visible in the usual way, as a xmlns declaration in the
root (context) element.

But this doesn't seem to work if I am loading just a route into an
existing context.

<route xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://camel.apache.org/schema/spring"
 xmlns:d="http://dhis2.org/schema/dxf/2.0"
 id="dataUpdater">

  <description>Import Metadata</description>
  <!-- every now and again ... -->
  <from uri="quartz://halfminute?trigger.repeatInterval=300000&amp;trigger.repeatCount=10"/>
  <to
       uri="http://localhost/trunk/api/metaData.xml?"/>
  <split>
      <xpath>/d:/dxf2/d:organisationUnit</xpath>
      <to .... />
  </split>

Camel complains that the xpath expression is illegal.  Has anyone come
across (and maybe solved) this problem before?

I've had a look at the tokenize xml approach, which seems nice (and
efficient) but again it doesn't seem to handle namespaces.

Any advice welcome.

Regards
Bob

Mime
View raw message