What type of object is the variable "is"?
I suspect that this regression is an adverse consequence of the patch for bug 2076001. I've reproduced it for the case where "is" is a DOM Node and for the case where it is a DOMSource. Unfortunately the interface is untyped and the specification gives no definitive list of object types allowed for this parameter. The whole JAXP XPath interface is very fragile, as well as being overly oriented to XPath 1.0 and DOM, and I would really recommend using s9api instead if you can.
Michael Kay

From: Roberto Cisternino [mailto:roberto.cisternino@gmail.com]
Sent: 16 January 2009 19:26
To: saxon-help@lists.sourceforge.net
Subject: [saxon] XPath evaluate not working as expected


SAXON B (latest version)


NodeList isList = (NodeList)getDefaultXPathInstance().evaluate("/xs:schema/xs:import", is, XPathConstants.NODESET);


Exception in thread "main" java.lang.ClassCastException: java.util.ArrayList


The same code was working fine using SAXON B (I nevr tested other minor-versions between 2 and 5).

The evaluate method should return the expected XPathConstants.NODESET data type which is org.w3c.dom.NodeList

The java.util.ArrayList type could be allowed through another XPath constant e.g. SaxonXpathConstants.ARRAYLIST ...

Hope this helps

Best Regards

Roberto Cisternino

Roberto Cisternino