camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Roger <olivier.ro...@bsb.com>
Subject Re: Velocity component
Date Thu, 22 Apr 2010 13:59:18 GMT

I could indeed unmarshal using JAXB but I would like to use as less Java as
possible.

I am facing an other problem now:
When I extract the value using XPath like this:

<setHeader
headerName="firstname"><xpath>/ns1:person/ns1:firstName/text()</xpath></setHeader>

and use it in the velocity template with:

Hello ${headers.firstname}

It produce this kind of result:

Hello com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@1acee78

Is there some way to use set the header value as text ?

Thanks in advance !


Christian Mueller wrote:
> 
> Hello Oliver!
> 
> I think another possibility could be for you to use JAXB to unmarshal your
> XML document into a java bean. Then you can use the following expression
> in
> your velocity template: $body.username
> 
> Please have a look on this test:
> 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityBodyAsDomainObjectTest.java?view=markup
> 
> and
> 
> http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/BodyAsDomainObject.vm?view=markup
> 
> Regards,
> Christian
> 
> 

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


Mime
View raw message