XML Tokenize
Since Camel 2.14
The XML Tokenize language is a built-in language in camel-stax
, which is a truly XML-aware tokenizer that can be used with the Split EIP as the conventional Tokenize to efficiently and effectively tokenize XML documents.
XML Tokenize is capable of not only recognizing XML namespaces and hierarchical structures of the document but also more efficiently tokenizing XML documents than the conventional Tokenize language.
XML Tokenizer Options
The XML Tokenize language supports 5 options, which are listed below.
Name | Default | Java Type | Description |
---|---|---|---|
|
| The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted token to its child content t - extracting the text content of the specified element. Enum values:
| |
| To group N parts together. | ||
| Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set. | ||
| Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set. | ||
|
| Whether to trim the value to remove leading and trailing whitespaces and line breaks. |
Example
See Split EIP which has examples using the XML Tokenize language.
Spring Boot Auto-Configuration
When using xtokenize with Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-stax-starter</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
The component supports 8 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean | |
Whether to enable auto configuration of the stax component. This is enabled by default. | Boolean | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean | |
Whether to enable auto configuration of the xtokenize language. This is enabled by default. | Boolean | ||
The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted token to its child content t - extracting the text content of the specified element. | i | String | |
Injects the XML Namespaces of prefix - uri mappings. | List | ||
Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set. | String | ||
Whether to trim the value to remove leading and trailing whitespaces and line breaks. | true | Boolean |