public class XPathTest extends CamelTestSupport {
@Test
public void testXPathUsingSaxon() throws Exception {
XPathFactory fac = new XPathFactoryImpl();
XPathBuilder builder = XPathBuilder.xpath("foo/bar").factory(fac);
// will evaluate as XPathConstants.NODESET and have Camel convert that to String
// this should return the String incl. xml tags
String name = builder.evaluate(context, "<foo><bar id=\"1\">cheese</bar></foo>", String.class);
assertEquals("<bar id=\"1\">cheese</bar>", name);
// will evaluate using XPathConstants.STRING which just return the text content (eg like text())
name = builder.evaluate(context, "<foo><bar id=\"1\">cheese</bar></foo>");
assertEquals("cheese", name);
}