Hi Claus, Thanks for the hint!! :)
Here is the solution: <transform> <xpath resultType="java.lang.String">/mymessage/uri/path/text()</xpath> </transform> <transform> <simple resultType="java.io.File">${body}</simple> </transform> Regards, Guillaume. -----Original Message----- From: Claus Ibsen [mailto:claus.ib...@gmail.com] Sent: Tuesday, June 12, 2012 15:56 To: users@camel.apache.org Subject: Re: XML message with file reference On Tue, Jun 12, 2012 at 3:46 PM, PAC Kieffer Guillaume < guillaume.kief...@panalpina.com> wrote: > Hi, > > I am using CAMEL 2.9 with XML DSL and blueprint, I have a design question: > > I am processing (routing ;) following xml: The XML contains a reference to > a specific file. > > <mymessage> > <uri> > <protocol>file</protocol> > <path>/mydirectory/myfile.ext</path> > <size/> > ....... > </uri> > </mymessage> > > The path element contains the path of a file I need to read; would > something like this be possible: > > <from uri="direct:incoming-msg"> > <transform> > <xpath > resultType="java.io.File">/mymessage/uri/path/text()</xpath> > </transform> > <to uri="direct:message-file"/> > > A simple solution would be to transform the body inside a bean... but I > would like to know if there is a pure XML DSL equivalent for that.. > > Yes I think that would be possible, as there is a String -> File type converter. But that requires that the xpath expression with the /text() will return a String instance, and not some w3c DOM / element object. Thanks for your help, > > Regards, > Guillaume. > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen