Gadi
Gadi

Reputation: 1629

Camel XPATH choice on xmlns attribute contains

I would like to use choice on xml namespace containing a value.

<Document xmlns="www.ddd.test.123.001">
 <properties>...
</Document>

in camel :

from("direct:in")
        .choice()
            .when().xpath("/Document[@xmlns, contains(., 'test.123')]")
        .to("mock:pain:001")

the xmlns contain the routing value I would like to use. Is it possible and what is the correct camel XPath string?

Upvotes: 0

Views: 299

Answers (1)

Michael Kay
Michael Kay

Reputation: 163272

I don't know Camel, but at in XPath 1.0 it would be

"/*[local-name() = 'Document' and contains(namespace-uri(), 'test.123')]"

You can't use /Document because that will only match a Document element in no namespace.

Upvotes: 1

Related Questions