The xpath expression is going to be evaluated against the incoming message body. So, if we have a message like:
<?xml version="1.0" encoding="UTF-8"?> <TravelInsuranceRequest xmlns="http://dzone.com/insurance"> ... </TravelInsuranceRequest> the first when clause will evaluate to true since the xpath expression is searching for any element like "TravelInsuranceRequest". The namespace bit tells Camel to search for TravelInsuranceRequest elements only in the http://dzone.com/insurance namespace. Does this help any? On Mon, Dec 14, 2009 at 3:40 PM, Kenneth H <phecda...@gmail.com> wrote: > > Hi, > > I'm trying to udnerstand a camel example, but I'm stuck at a poit where > xpath is used. The builder is shown here: > > public void configure() { > from(SERVICE_IN) // SERVICE_IN = > jbi:service:http://esbinaction.com/insurance/insuranceDSLRouter > .convertBodyTo(DOMSource.class) // Convert to DOM > tree > .choice() > > .when(xpath("//ins:TravelInsuranceRequest").namespace("ins", > "http://dzone.com/insurance")) > .to(TRAVEL_OUT) > > .when(xpath("//ins:CarInsuranceRequest").namespace("ins", > "http://dzone.com/insurance")) > .to(LUXURY_CAR_OUT, BUDGET_CAR_OUT) > .otherwise() > .to(FAILURE_OUT); > } > > My problem is the "when": what exactly does: > > when(xpath("//ins:TravelInsuranceRequest").namespace("ins", > "http://dzone.com/insurance")) > > mean? > > Can anybody help me? > > Kind regards, > Kenneth H > -- > View this message in context: > http://old.nabble.com/Help-to-understand-xpath-expression-in-camel-routebuilder-tp26779963p26779963.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Cheers, Jon Camel in Action: http://manning.com/ibsen Blog: http://janstey.blogspot.com