As a matter of principle, I would prefer it if you don't go off-list. Although the conversation might not interest everyone on the list, it's important that once the question is in the archives, the subsequent correspondence and final conclusion should also be in the archives.
If the System.out.println() line wasn't executed, then presumably an exception was thrown by the evaluate() call. It would be nice to know what that exception was. It should be easy for you to determine whether (a) the exception occurred during the call on evaluate(), or (b) it occurred when casting the result to a DOM NodeList.
It would be useful to verify that the XPath implementation returned by the factory is indeed the Saxon implementation. You can do this by printing the class name of the returned instance.
You should be able with Saxon 9.0 to rely on the fact that if node is an instance of org.w3.dom.Node, then evaluate(node, XPathConstants.NODESET) will return an instance of org.w3.dom.NodeList.
Michael Kay

From: Rakesh guttal []
Sent: 10 December 2007 11:28
To: Michael Kay
Subject: Re: RE: [saxon] Difference Between SAXON 8.8 and

Hi Michael,

Below is a part of code where i am facing some problems.

    NodeList resultList      = null;
    XPathFactory factory      = null;
    XPath xpath                = null;
    XPathExpression members = null;
    System.out.println("before setting system property");
    String objectModel=XPathConstants.DOM_OBJECT_MODEL;
     try {
          factory      = XPathFactory.newInstance(objectModel);
     } catch (XPathFactoryConfigurationException e1) {
          System.out.println("exception thrown");
     xpath           = factory.newXPath();
      members = xpath.compile("(. | *)[count(@*)=0 or count(@code)>0 or count(@size)>0 or count(@countryId)>0]");
      Node node=resultList.item(i);

        System.out.println("before members.evaluate, node: "+node);
        // elements of bo tag
        NodeList children = (NodeList) members.evaluate(node, XPathConstants.NODESET);
        System.out.println("after members.evaluate "); 

Note: node contains just one element.

when using SAXON 8.8 (report is generated successfully), I get below output

before members.evaluate, node: [option:null]
after members.evaluate

when using SAXON 9.0. Jars used on classpath saxon9-dom.jar,saxon9sa.jar , saxon-xpath.jar & directory which contains license file. I get below output

before members.evaluate, node: [option:null]

It doesn't print the message "after members.evalute()" message.

Does the newer version of SAXON doesn't return nodelist if source node contain only one element?

Thanks in advance,

On Mon, 10 Dec 2007 Michael Kay wrote :
>There's no attachment. If you need to submit attachments it's best to do it
>using the support-requests tracker on SourceForge. However, if you can then
>it's better to try and cut the problem down to a few lines to make it easier
>to see what's going on.
>There have been quite a few changes in the XPath APIs between Saxon 8.8 and
>Saxon 9.0 in an attempt to improve conformance with the JAXP specifications
>while still supporting use of XPath 2.0 and non-DOM object models. You
>should find most of these changes described in the change logs for the
>various releases.
>Michael Kay
>  _____
> From:
>[] On Behalf Of Rakesh guttal
>Sent: 10 December 2007 07:24
>Subject: [saxon] Difference Between SAXON 8.8 and
>I am using using J.D.K 1.4.2 and SAXON 8.8.
>Every thing was working fine with SAXON 8.8. But, when I tried to use SAXON
> it is not working correctly.
>Please find attached the file where i am using XPATH,
>Line number on which It is failing is 189.
>NodeList children=(NodeList)members.evaluate(node,XPathConstants.NODESET).
>It is not printing the System.out message after this line, when using SAXON
> But it works fine with SAXON 8.8.
>Please Provide any information regarding this.
>Thanks & Regards,
>null target=new> Shaadi