skin27 commented on code in PR #25977:
URL: https://github.com/apache/camel/pull/25977#discussion_r3897782982
##########
components/camel-stax/src/main/docs/xtokenize-language.adoc:
##########
@@ -25,4 +44,100 @@ include::partial$language-options.adoc[]
== Example
-See xref:eips:split-eip.adoc[Split EIP], which has examples using the XML
Tokenize language.
+Suppose the input XML contains multiple orders:
+
+[source,xml]
+----
+<?xml version="1.0" encoding="UTF-8"?>
+<orders xmlns="urn:shop">
+ <order>
+ <id>1001</id>
+ <customer>John</customer>
+ </order>
+ <order>
+ <id>1002</id>
+ <customer>Jane</customer>
+ </order>
+</orders>
+----
+
+The XML Tokenize language can be used with the Split EIP to split the document
+into one message for each `order` element.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+var ns = new org.apache.camel.support.builder.Namespaces("shop", "urn:shop");
+
+from("direct:start")
+ .split()
+ .xtokenize("//shop:order", 'i', ns)
+ .streaming()
+ .to("mock:order");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="direct:start"/>
+ <split streaming="true">
+ <xtokenize>//shop:order
+ <namespace key="shop" value="urn:shop"/>
+ </xtokenize>
+ <to uri="mock:order"/>
+ </split>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: 'direct:start'
+ steps:
+ - split:
+ streaming: 'true'
+ expression:
+ xtokenize:
+ expression: '//shop:order'
+ namespace:
+ ns1: 'urn:shop'
Review Comment:
The example for namespace was taken from the split EIP documentation:
https://camel.apache.org/components/4.22.x/eips/split-eip.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]