/**
* Creates a new xpath expression as there we no available in the pool.
* <p/>
* This implementation must be synchronized to ensure thread safety, as this XPathBuilder instance may not have been
* started prior to being used.
*/
protected synchronized XPathExpression createXPathExpression() throws XPathExpressionException, XPathFactoryConfigurationException {
// ensure we are started
try {
start();
} catch (Exception e) {
throw new RuntimeExpressionException("Error starting XPathBuilder", e);
}
// XPathFactory is not thread safe
XPath xPath = getXPathFactory().newXPath();
if (!logNamespaces && LOG.isTraceEnabled()) {
LOG.trace("Creating new XPath expression in pool. Namespaces on XPath expression: {}", getNamespaceContext().toString());
} else if (logNamespaces && LOG.isInfoEnabled()) {
LOG.info("Creating new XPath expression in pool. Namespaces on XPath expression: {}", getNamespaceContext().toString());
}
xPath.setNamespaceContext(getNamespaceContext());
xPath.setXPathVariableResolver(getVariableResolver());
XPathFunctionResolver parentResolver = getFunctionResolver();
if (parentResolver == null) {
parentResolver = xPath.getXPathFunctionResolver();
}
xPath.setXPathFunctionResolver(createDefaultFunctionResolver(parentResolver));
return xPath.compile(text);
}
XPathBuilder.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:Camel
作者:
评论列表
文章目录