This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I have been trying to use the DOM Level 3 Test Suite for XPath API. I think there is a bug in the following testcase: org.w3c.domts.level3.xpath.XPathEvaluator_evaluate_document This test case has following code: ---------------------------------------- public void runTest() throws Throwable { Document doc; XPathEvaluator xpEvaluator; Element root; XPathResult result; XPathNSResolver nullNSResolver = null; XPathResult nullResult = null; doc = (Document) load("staffNS", false); xpEvaluator = (XPathEvaluator) createXPathEvaluator(doc); root = (Element) doc; // This line has problem. result = (XPathResult) xpEvaluator.evaluate("/", root, nullNSResolver, (short) 0, ((Object) /*XPathResult */nullResult)); assertNotNull("notnull", result); } ----------------------------------- The line of code: root = (Element) doc; has a problem. This line tries to cast org.w3c.dom.Document to org.w3c.dom.Element. This line results in ClassCastException because these two interfaces are not in same inheritance tree. This line of code should be changed as follows: root = doc.getDocumentElement(); The identical problem is also seen in other testcases such as follows: org.w3c.domts.level3.xpath.XPathExpression_evaluate_document has a line in runTest() method: contextNode = (Element) doc; // throws ClassCastException. should be changed to: contextNode = doc.getDocumentElement();