Hi Michael,

I am using saxon 8.8 version of your saxon product.
In order to improve the performance , i am using saxon's net.sf.saxon.xpath.XPathFactoryImpl for xpath querying.

here goes Test java file.

/////////////////////////////////////////////////////
public class Test {
        private XPathFactory      factory = null;
     private XPath           xpath = null;
     
     public static void main(String[] args) {
          
          System.setProperty("javax.xml.xpath.XPathFactory:"+XPathConstants.DOM_OBJECT_MODEL,"net.sf.saxon.xpath.XPathFactoryImpl");
          XPathFactory      factory = null;
          XPath           xpath = null;
          
          String objectModel=XPathConstants.DOM_OBJECT_MODEL;
          try {
               factory      = XPathFactory.newInstance(objectModel);
          } catch (XPathFactoryConfigurationException e1) {
               e1.printStackTrace();
          }
          
          xpath           = factory.newXPath();
          Document document = null;
         try {
              System.out.println("before documentbuild");
           DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
           DocumentBuilder db = dbf.newDocumentBuilder();
           Test a = new Test();
           InputStream is = a.getResourceAsInputStream("IUFReportSchema.xsd");
           document = db.parse(is);
           System.out.println("document:"+document);
           is.close();
          
           Node root = document.getDocumentElement();
           NodeList elements = null;
          
              
           String query = "element[@name='option']";
           System.out.println("query="+query);
          
           XPathExpression xpthQuery=xpath.compile(query);
          
           elements = (NodeList)xpthQuery.evaluate( root, XPathConstants.NODESET);
          
           System.out.println("elements size:"+elements.getLength());
           //log.info("Resource file parsed " + filename);
         }
         catch (Exception e) {
           // log.error("Problem parsing [" + filename + "]");
           //log.error("Exception: "+e.getMessage());
         }

  public InputStream getResourceAsInputStream(String filename) {
         return getClass().getClassLoader().getResourceAsStream  (filename);
       }
}
////////////////////////////////////////////////////////

when I run above java file with saxon8-xpath.jar on classpath,i get the below output (which is expected)

elements size:1

But, when I run this file with saxon8-xpath.jar & saxon8sa.jar, i get an unexpected output.

elements size:0

Why is that when i include saxon8sa.jar apart from saxon8-xpath.jar on classpath, it affects the xpath querying result? it's not able to find an element with name "option" and it returns nodelist of size 0.

Regards,
Rakesh



Monster