0

I have a document with an order and a number of lines. I need to break the order into lines so I have a camel splitter set to xpath with the order line as it's value. This works fine.

However, what I get going forward is an element for the order line, which is what I want, but when converting it I need information from the order element - but if I try to get the parent element via xpath following the split, this doesn't work.

Does Camel create copies of the nodes returned by the xpath expression, or return a list of nodes within the parent document? If the former, can I make it the latter? If the latter, any ideas why a "../*" expression would return nothing?

Thanks!

Screwtape.

1 Answer 1

2

Look at the split options that are available when using a Tokenizer: http://camel.apache.org/splitter.html

You have four different modes (i, w, u, t) and the 'w' one is keeping the ancestor context. In such case, the parent node (=the thing you apparently need) will be repeated in each sub-message

Default:

<m:order><id>123</id><date>2014-02-25</date></m:order>

'w' mode:

<m:orders>
  <m:order><id>123</id><date>2014-02-25</date>...</m:order>
</m:orders>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.