How to retrieve comments with Camel and XPath

Viewed 167

I defined a route that consumes an XML message from a JMS queue. The processing is just the extraction of the comment and log it.

    from("jms:so")
            .setHeader("comment").xpath("//comment()", String.class)
            .setHeader("firstComment").xpath("//comment()[1]", String.class)
            .log("comment is ${headers.comment}")
            .log("first comment is ${headers.firstComment}")
            .to("jms:so.out");

The message is simple:

<StackOverflow>
    <!--Camel-->
    <Nested>
    <!--Nested Camel-->
    </Nested>
</StackOverflow>

The issue is that the comment values are not extracted.

0 Answers
Related