// create the JAXP XPath evaluation environment.
XPath xpath = XPathFactory.newInstance().newXPath();
// creat an xpath expression. This example select all nodes with the
// name 'link' from the root of the document.
String expression = "//link";
// get a list of nodes using the xpath environment, DOM Document and the
// XPath expression. Specify the type of node that is retrived (in this
// case its a NODESET which is a list of nodes)
NodeList linkNodes = (NodeList) xpath.evaluate(expression, bbcDoc, XPathConstants.NODESET);
for (int i = 0; i < linkNodes.getLength(); i++) {
// System.out.println(linkNodes.item(i).getTextContent());
}
Xerces used to be released as a single jar (xerces.jar), but was split into two jars, one containing the API (xml-apis.jar) and one containing the implementations of those APIs (xercesImpl.jar). Many older Maven POMs still declare a dependency on xerces.jar. At some point in the past, Xerces was also released as xmlParserAPIs.jar, which some older POMs also depend on.