use of org.springframework.util.xml.SimpleNamespaceContext in project spring-framework by spring-projects.
the class XpathExpectationsHelper method compileXpathExpression.
private XPathExpression compileXpathExpression(String expression, Map<String, String> namespaces) throws XPathExpressionException {
SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
namespaceContext.setBindings((namespaces != null) ? namespaces : Collections.<String, String>emptyMap());
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.setNamespaceContext(namespaceContext);
return xpath.compile(expression);
}
Aggregations