Java tutorial
//package com.java2s; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; public class Main { /** * @param xpathExp * @return * @throws XPathExpressionException */ public static XPathExpression createXpath(String xpathExp) throws XPathExpressionException { XPathFactory xFactory = XPathFactory.newInstance(); XPath xPath = xFactory.newXPath(); XPathExpression expr = xPath.compile(xpathExp); return expr; } }