0

Is there any tool available that can convert java DSL to XML route or vice versa.

I want to convert the following XML route into Java DSL

<route id="test">
    <from uri="file://{{VAR_DATA_PATH}}/test/xml"/>
    <multicast>
        <choice>
            <when>
                <xpath>/bookinfo</xpath>
                <doTry>
                    <to uri="downloadBook"/>
                    <marshal ref="xstream-utf8"/>
                    <to uri="another URI"/>
                    <doCatch>
                        <exception>java.lang.Exception</exception>
                        <handled>
                            <constant>false</constant>
                        </handled>
                        <to uri="3rd URI"/>
                    </doCatch>
                </doTry>
            </when>
            <when>
                <xpath>somePath</xpath>
                <to uri="4th URI" />
                <to uri="5th URI"/>
            </when>
        </choice>
        <to uri="6th URI" />
    </multicast>
</route>
1
  • 1
    No there is no such tool. Its also easy to convert the xml to java code, as the DSL between XML and Java is from the same source. Aug 4, 2015 at 7:47

1 Answer 1

1

From Java DSL to XML, it's fairly easy. You can use Hawtio or karaf's "route-info" command. Even though the routes are in Java DSL, when you view them it would be XML.

I'm not aware of the other way around (from XML to Java) but it's not difficult at all to do it yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.