You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Felix Hoßfeld (Jira)" <ji...@apache.org> on 2022/01/10 18:41:00 UTC

[jira] [Created] (CAMEL-17466) xtokenize does not select following siblings in mode "W"

Felix Hoßfeld created CAMEL-17466:
-------------------------------------

             Summary: 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
         Environment: Servicemix 7.0.1 -> Camel 2.16.5
            Reporter: Felix Hoßfeld


{{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.1#820001)