XPathHelper { public Node getNode(String pathExpr, Node node) { try { return (Node) xPath.evaluate(pathExpr, node, XPathConstants.NODE); } catch (XPathExpressionException e) { throw new IllegalArgumentException("XPpath '" + pathExpr + "' invalid.", e); } } XPathHelper(XPath xPath); String getString(String pathExpr, Node node); NodeList getNodeList(String pathExpr, Node node); Node getNode(String pathExpr, Node node);  }
@Test public void testGetNode() throws Exception { Node node = xPathHelper.getNode("/xml/secondTag/valueTag", xmlDoc); assertEquals("C", node.getTextContent()); }