Camel supports JXPath to allow XPath expressions to be used on beans in an Expression or Predicate to be used in the DSL or Xml Configuration. For example you could use JXPath to create an Predicate in a Message Filter or as an Expression for a Recipient List.
You can use XPath expressions directly using smart completion in your IDE as follows
Using XML configuration
If you prefer to configure your routes in your Spring XML file then you can use JXPath expressions as follows
You can use Bean Integration to invoke a method on a bean and use various languages such as JXPath to extract a value from the message and bind it to a method parameter.
Loading script from external resource
Available as of Camel 2.11
You can externalize the script and have Camel load it from a resource such as
To use JXpath in your camel routes you need to add the a dependency on camel-jxpath which implements the JXpath language.
If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see the download page for the latest versions).
Otherwise, you'll also need Commons JXPath.