List of usage examples for javax.xml.xpath XPathFunctionException XPathFunctionException
public XPathFunctionException(Throwable cause)
From source file:org.apache.camel.builder.xml.XPathBuilder.java
public XPathFunction getPropertiesFunction() { if (propertiesFunction == null) { propertiesFunction = new XPathFunction() { public Object evaluate(List list) throws XPathFunctionException { if (exchange != null && !list.isEmpty()) { Object value = list.get(0); if (value != null) { String text = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);//w w w .ja v a 2s . c o m try { // use the property placeholder resolver to lookup the property for us Object answer = exchange.get().getContext() .resolvePropertyPlaceholders("{{" + text + "}}"); return answer; } catch (Exception e) { throw new XPathFunctionException(e); } } } return null; } }; } return propertiesFunction; }
From source file:org.apache.synapse.mediators.GetPropertyFunction.java
/** * Wraps jaxon xpath function as a javax.xml.xpath.XPathFunction * @param args List of argument for custom xpath function * @return result of xpath evaluation/*from w w w . ja v a 2s . co m*/ * @throws XPathFunctionException */ public Object evaluate(List args) throws XPathFunctionException { try { return call(new Context(new ContextSupport()), args); } catch (FunctionCallException e) { throw new XPathFunctionException(e); } }