Javaでhttp://www.amazon.com/gp/bestsellers/electronicsorg.w3c.dom.NodeListからa を抽出しようとしています。Google Chrome JavaScript コンソールで結果を表示するために使用した XPath ステートメントを次に示します。
$x("//div[@class='zg_itemRightDiv_normal']")
上記のステートメントは問題なく機能しましたが、Javajavax.xml.xpathとorg.w3c.domライブラリを使用すると結果が得られません。
XPathExpression expr = xPath.compile("//div[@class='zg_itemRightDiv_normal']");
NodeList productNodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
// In the above productNodes definition, doc is a org.w3c.dom.DocumentFragment
System.out.println(productNodes.getLength()); // prints out '0'
私は何が欠けていますか?