[ 
https://issues.apache.org/jira/browse/CAMEL-17466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17558550#comment-17558550
 ] 

Karen Lease commented on CAMEL-17466:
-------------------------------------

{quote}The documentation mentions that the mode "w" will include the node in 
its ancestor content. Strictly speaking, the XPath ancestor would exclude 
{{{}<Level2preceding>{}}}. If I understand the XPath spec correctly the current 
implementation {{uses ancestor:: | preceding::}} as the wrapper which it is a 
bit counterintuitive. 
{quote}
Indeed it is; I've done a lot of XML processing and I would *not* expect the 
context to include all the content of each ancestor, but only the ancestor 
element itself. The example in the Split EIP documentation doesn't show this 
case, but the existing test cases do assume that in mode w, the ancestor 
content is also included. But if we take this logic to its conclusion, we would 
also include all content of the immediate ancestor <Level2> which is to say all 
the data elements, which is clearly not what is intended.
I would suggest that the implementation should include less context and not 
more!

> xtokenize does not select following siblings in mode "W"
> --------------------------------------------------------
>
>                 Key: CAMEL-17466
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17466
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>         Environment: Servicemix 7.0.1 -> Camel 2.16.5
>            Reporter: Felix Hoßfeld
>            Priority: Minor
>             Fix For: 3.x
>
>
> Given the following XML:
> {{<root>}}
> {{  <Level1>}}
> {{    <Level2preceding>Included</Level2preceding>}}
> {{    <Level2>}}
> {{      <data>Hello, World!</data>}}
> {{      <data>Hello, Camel!</data>}}
> {{      <data>Hello, Apache Foundation!</data>}}
> {{    </Level2>}}
> {{    <Level2following>Not Included</Level2following>}}
> {{  </Level1>}}
> {{</root>}}
> and the following xtokenizer:
> <xtokenize mode="w">/root/Leve1/Level2/data</xtokenize>
> will yield the following result:
> {{<root>}}
> {{  <Level1>}}
> {{    <Level2preceding>Included</Level2preceding>}}
> {{    <Level2>}}
> {{      <data>Hello, World!</data>}}
> {{    </Level2>}}
> {{  </Level1>}}
> {{</root>}}
> Please note that the node {{<Level2following/>}} is missing while 
> {{<Level2preceding/>}} is included. Since both nodes are a child of 
> {{<Level1/>}} the tokenizer should include {{{}<Level2following/>{}}}, too, 
> since they are a child of a ancestor of the {{<data/>}} node which the 
> splitter processes.
> The documentation mentions that the mode "w" will include the node in its 
> ancestor content. Strictly speaking, the XPath ancestor would exclude 
> {{<Level2preceding>}}. If I understand the XPath spec correctly the current 
> implementation {{uses ancestor:: | preceding::}} as the wrapper which it is a 
> bit counterintuitive. 



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to