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:[email protected]]
Sent: Tuesday, June 12, 2012 15:56
To: [email protected]
Subject: Re: XML message with file reference
On Tue, Jun 12, 2012 at 3:46 PM, PAC Kieffer Guillaume <
[email protected]> 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: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen