Hi Olivier,

This is not possible at the moment with the velocity component since there
is no way to assume that the payload in the exchange body is an XML
fragment. It could be a straight text string or a GIF/JPEG.

But there is a workaround. If you know that payload to be XML, you could
create the right header elements on the route by adding values as needed to
the content header using a convenient processor and then use a velocity
template. 

If you feel strongly about this need, please create a JIRA entry requesting
this feature that would only work on XML based payloads sent in the body
element.

Cheers,

Ashwin...


Olivier Roger wrote:
> 
> Hello,
> 
> When trying to use the Velocity component I encountered a problem.
> I have a Simple SQL query I would like to built using the Message Body
> (XML)
> 
> I was using an XSL file to perform the transformation by extracting the
> values into the SQL query templace. 
> 
> <xsl:template match="/">INSERT INTO person VALUES('<xsl:value-of
> select="ns0:person/ns0:username"/>','<xsl:value-of
> select="ns0:person/ns0:firstName"/>','<xsl:value-of
> select="ns0:person/ns0:lastName"/>','<xsl:value-of
> select="ns0:person/ns0:mailAddress"/>','<xsl:value-of
> select="ns0:person/ns0:password"/>','<xsl:value-of
> select="ns0:person/ns0:address/ns0:zipCode"/>','<xsl:value-of
> select="ns0:person/ns0:socialId"/>')</xsl:template>
> 
> However I think using Velocity would be easier to understand.
> 
> Is there a way to using the ${body.<xpath>} placeholder in the velocity
> template? because at the moment I use the headers, which works, but is not
> really practical for larger files.
> 
> Here is my expected VM file
> 
> INSERT INTO person
> VALUES('${body.ns0:person/ns0:username}','${body.ns0:person/ns0:firstName}','${body.ns0:person/ns0:lastName}','${body.ns0:person/ns0:mailAddress}','${body.ns0:person/ns0:password}','${body.ns0:person/ns0:address/ns0:zipCode}','${body.ns0:person/ns0:socialId}')
> 
> 
> I am also intressted in any other way to use the body values.
> 
> Thanks in avance,
> 
> Olivier
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


-- 
View this message in context: 
http://old.nabble.com/Velocity-component-tp28287678p28287894.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to