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
http://www.saxonica.com/


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

USING:

SAXON B 9.1.0.5 (latest version)

CODE:

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

ERROR:

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

COMMENTS:

The same code was working fine using SAXON B 9.1.0.2 (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