On Nov 21, 2012, at 9:27 AM, [email protected] wrote:
> 
> We are using CXF WebServices in our project web module running on Tomcat. 
> Now we have Saxon 6.5.5 library in our project dependecies, but we are going 
> to use Saxon 9.4 to get benefit of using XSLT2.0.
> 
> The problem is that it seams CXF framework doesn’t work with Saxon 9.4 
> library (error soap response with a message inside it saying can't cast 
> Arraylist to a nodelist),
> 
> because: 
> Saxon has taken to XSLT 2.0 and XPath 2.0 implementation. In 9.4 the library 
> goes on to override the default namespace for Xpath to a Saxon 
> implementation, this wasn't done in 6.x version. The issue is mainly centered 
> around the implementation of "xpath.evaluate(expression, inputSource, 
> XPathConstants.NODESET);".
> 
> If the InputSource passed is a org.xml.sax.InputSource then an ArrayList (of 
> TinyElementImpl) is returned back. If the InputSource is a Document, only 
> then it returns a NodeList which most of the callers expect. Michael Kay 
> (person who wrote Saxon) says in his blog post the reason behind this change.

Well, I would consider this behavior completely wrong.   The javadoc for 
XPathConstants.NODESET specifically says this is mapped to NodeList.    Thus, 
he's violating the specs and the contract for that return type.  If he created 
his own QName "SaxonConstants.ARRAYLIST" or something, I'd be 100% for that, 
but violating a spec is just a bad idea to me.


> It seams CXF expects a NodeList return type that’s why XML -->Java -->XML 
> marshalling is impacted.

Well, the spec says it should be a NodeList, so why shouldn't we expect it?

> Does anyone know some workaround to make CXF work with Saxon 9.4, 
> except hacking classpath to inject lets say Xalan library to be picked up 
> before Saxon library to satisfy CXF framework? 

If you can provide some stack traces and such in the areas that don't work, we 
might be able to provide some workarounds or hacks or something.   Wrappering 
an ArrayList with something that implements NodeList is relatively simple.


-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to