Java XPath Create getXPathExpression(String expression)

Here you can find the source of getXPathExpression(String expression)

Description

get X Path Expression

License

Apache License

Declaration

public static XPathExpression getXPathExpression(String expression) throws XPathExpressionException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

public class Main {
    private static XPath xpath = null;

    public static XPathExpression getXPathExpression(String expression) throws XPathExpressionException {
        return getXPath().compile(expression);
    }//from   ww  w .ja va2s.c o  m

    private static XPath getXPath() {
        if (xpath == null) {
            xpath = XPathFactory.newInstance().newXPath();
        }
        return xpath;
    }
}

Related

  1. getXPath(Node node)
  2. getXPath(Node node, String xpath)
  3. getXPath(String exp, NamespaceContext ctx)
  4. getXPath(String expression)
  5. getXPathExpression(final Node node)
  6. getXPathExpression(String path)
  7. getXPathExpression(String xpath, NamespaceContext namespaceContext)
  8. getXPathExpression(String xpathStr)
  9. getXPathExpression(String xPathString)