XPath xpath = XPathFactory.newInstance().newXPath();
NodeList nodeList = (NodeList) xpath.evaluate("//a", startingDoc, XPathConstants.NODESET);
for(int i=0; i < nodeList.getLength(); i++)
{
HTMLLinkElementImpl anchor = (HTMLLinkElementImpl) nodeList.item(i);
System.out.println(anchor.getHref());
}
NodeList resultedDivs = (NodeList) xpath.evaluate("//div[@id='resultStats']", startingDoc, XPathConstants.NODESET);
for(int i=0; i < resultedDivs.getLength(); i++)
{