Same ClassCast Exception:

java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.dom.TextImpl cannot be cast to
java.lang.String

Cheers,
Markus

On 24 July 2015 at 14:11, Jakub Korab <jakub.korab.li...@gmail.com> wrote:
> Try setting the return type from the xpath expression:
>
> .setHeader("isbns", xpath("/order//isbn/text()", List.class))
>
> Jakub
>
>
> On 24/07/15 13:05, Markus Eisele wrote:
>>
>> Hi,
>>
>> I was trying to convert a bunch of //text() Nodes selected via XPath
>> into a List<String> and keep getting a ClassCastException.
>>
>> My input xml:
>>
>>    <isbn>9781617290450</isbn>
>>   <isbn>9780132360280</isbn>
>>
>> The route
>>
>> .setHeader("isbns", xpath("/order//isbn/text()"))
>> .bean(orderService, "handleOrder(${header[isbns]})")
>>
>> The Bean Method:
>>
>> public void handleOrder(List<String> orders) {
>>
>>          orders.stream().forEach((o) -> {
>>              LOGGER.log(Level.INFO, "Order: {0}", o);
>>          });
>>
>>
>> Thanks for a hint.
>>
>> Cheers,
>> Markus
>
>

Reply via email to