Here you can find the source of getXPathExpression(String expression)
public static XPathExpression getXPathExpression(String expression) throws XPathExpressionException
//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; } }