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