XML Io Dsl

Since Camel 3.9

The xml-io-dsl is the Camel optimized XML DSL with a very fast and low overhead XML parser. The classic XML DSL was loaded via JAXB that is heavy and overhead.

The JAXB parser is generic and can be used for parsing any XML. However, the xml-io-dsl is a source code generated parser that is Camel specific and can only parse Camel .xml route files (not classic Spring <beans> XML files).

If you are using Camel XML DSL then its recommended using xml-io-dsl instead of xml-jaxb-dsl. You can use this in all of Camel’s runtime such as Spring Boot, Quarkus, Camel Main, and Camel K etc.

Example

The following my-route.xml source file:

my-route.xml
<routes xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="timer:tick"/>
        <setBody>
            <constant>Hello Camel K!</constant>
         </setBody>
        <to uri="log:info"/>
    </route>
</routes>
You can omit the xmlns namespace. And if there is only a single route, you can use <route> as the root XML tag.

Can then be loaded and run with Camel CLI or Camel K.

Running with Camel K
kamel run my-route.xml
Running with Camel CLI
camel run my-route.xml

See Also

See DSL