camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ext2" <x...@tongtech.com>
Subject an un-easy way to use camel-xpath in:header() function
Date Fri, 20 May 2011 05:10:18 GMT
Using camel's in:header() xpath function,  we can deal with  xml stored in
message header very easy; for example:
	<setHeader name="cheaperBooks">
		<xpath>in:header('bookstore')/child::book[price<100]</xpath>
	</setHeader>

The setHeader could retrieve all cheaper books(price less than 100) from a
bookstore xml (which already stored in message header('bookstore')

But in camel, things are not always so easy. The user must make sure input
message's body must be a valid XML or null(although the body's content may
have nothing to do with the bookstore xml). Otherwise the above xapth
express will failed; 

Suggestion(Maybe):

Camel's XPath expression should check if the input body's content could be
convert to xml. If the body cannot, then using a null instead of original
message body to do XPathExpression.evaluate;



Mime
View raw message