On Thu, Apr 22, 2010 at 3:59 PM, Olivier Roger <olivier.ro...@bsb.com> wrote:
>
> 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.dtmnodel...@1acee78
>
> Is there some way to use set the header value as text ?

You have to tell the <xpath> that the resultType should be String

<xpath resultType="String">bla bla</xpath>

See setting result type
http://camel.apache.org/xpath


>
> 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.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to