/** * Creates a JAXP 1.3 {@code XPathExpression} from the given string expression. * * @param expression the XPath expression * @return the compiled {@code XPathExpression} * @throws XPathParseException when the given expression cannot be parsed */ static XPathExpression createXPathExpression(String expression) { try { XPath xpath = createXPath(); javax.xml.xpath.XPathExpression xpathExpression = xpath.compile(expression); return new Jaxp13XPathExpression(xpathExpression, expression); } catch (XPathExpressionException ex) { throw new org.springframework.xml.xpath.XPathParseException( "Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex); } }
/** * Creates a JAXP 1.3 {@code XPathExpression} from the given string expression. * * @param expression the XPath expression * @return the compiled {@code XPathExpression} * @throws XPathParseException when the given expression cannot be parsed */ static XPathExpression createXPathExpression(String expression) { try { XPath xpath = createXPath(); javax.xml.xpath.XPathExpression xpathExpression = xpath.compile(expression); return new Jaxp13XPathExpression(xpathExpression, expression); } catch (XPathExpressionException ex) { throw new org.springframework.xml.xpath.XPathParseException( "Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex); } }
/** * Creates a JAXP 1.3 {@code XPathExpression} from the given string expression and namespaces. * * @param expression the XPath expression * @param namespaces the namespaces * @return the compiled {@code XPathExpression} * @throws XPathParseException when the given expression cannot be parsed */ public static XPathExpression createXPathExpression(String expression, Map<String, String> namespaces) { try { XPath xpath = createXPath(); SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext(); namespaceContext.setBindings(namespaces); xpath.setNamespaceContext(namespaceContext); javax.xml.xpath.XPathExpression xpathExpression = xpath.compile(expression); return new Jaxp13XPathExpression(xpathExpression, expression); } catch (XPathExpressionException ex) { throw new org.springframework.xml.xpath.XPathParseException( "Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex); } }
/** * Creates a JAXP 1.3 {@code XPathExpression} from the given string expression and namespaces. * * @param expression the XPath expression * @param namespaces the namespaces * @return the compiled {@code XPathExpression} * @throws XPathParseException when the given expression cannot be parsed */ public static XPathExpression createXPathExpression(String expression, Map<String, String> namespaces) { try { XPath xpath = createXPath(); SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext(); namespaceContext.setBindings(namespaces); xpath.setNamespaceContext(namespaceContext); javax.xml.xpath.XPathExpression xpathExpression = xpath.compile(expression); return new Jaxp13XPathExpression(xpathExpression, expression); } catch (XPathExpressionException ex) { throw new org.springframework.xml.xpath.XPathParseException( "Could not compile [" + expression + "] to a XPathExpression: " + ex.getMessage(), ex); } }