xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r648478 - in /xmlbeans/trunk: ./ src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/ src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/
Date Wed, 16 Apr 2008 00:56:50 GMT
Author: radup
Date: Tue Apr 15 17:56:48 2008
New Revision: 648478

URL: http://svn.apache.org/viewvc?rev=648478&view=rev
Log:
Support for Saxon 9. Contributed by Wing Yew Poon.

Removed:
    xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansIndependentContext.java
Modified:
    xmlbeans/trunk/build.xml
    xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
    xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
    xmlbeans/trunk/testbuild.xml

Modified: xmlbeans/trunk/build.xml
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/build.xml?rev=648478&r1=648477&r2=648478&view=diff
==============================================================================
--- xmlbeans/trunk/build.xml (original)
+++ xmlbeans/trunk/build.xml Tue Apr 15 17:56:48 2008
@@ -53,6 +53,7 @@
     <target name="clean.jars" description="Delete any downloaded jars and accompanying
licenses">
         <delete>
             <fileset dir="external/lib">
+                <include name="saxonb9-0-0-4j.zip"/>
                 <include name="saxonb8-8j.zip"/>
                 <include name="saxonb8-7-3j.zip"/>
                 <include name="saxonb8-6-1.zip"/>
@@ -60,6 +61,8 @@
                 <include name="saxonb8-1.zip"/>
                 <include name="jsr173_1.0_api_bundle.jar"/>
                 <include name="jsr173_1.0_api.jar"/>
+                <include name="saxon9.jar"/>
+                <include name="saxon9-dom.jar"/>
                 <include name="saxon8.jar"/>
                 <include name="saxon8-dom.jar"/>
                 <include name="xcresolver.zip"/>
@@ -85,42 +88,43 @@
 
     <property environment="env"/>
     <target name="saxon.find1" if="env.XMLBEANS_EXTERNALS">
-      <property name="saxon_jar" value="${env.XMLBEANS_EXTERNALS}/saxon8.jar"/>
-      <property name="saxon_dom_jar" value="${env.XMLBEANS_EXTERNALS}/saxon8-dom.jar"/>
+      <property name="saxon_jar" value="${env.XMLBEANS_EXTERNALS}/saxon9.jar"/>
+      <property name="saxon_dom_jar" value="${env.XMLBEANS_EXTERNALS}/saxon9-dom.jar"/>
     </target>
     <target name="saxon.find2">
-      <property name="saxon_jar" value="build/lib/saxon8.jar"/>
-      <property name="saxon_dom_jar" value="build/lib/saxon8-dom.jar"/>
+      <property name="saxon_jar" value="build/lib/saxon9.jar"/>
+      <property name="saxon_dom_jar" value="build/lib/saxon9-dom.jar"/>
     </target>
 
-    <target name="check.saxon8.jar" depends="saxon.find1,saxon.find2">
-      <condition property="saxon8.jar.exists">
+    <target name="check.saxon9.jar" depends="saxon.find1,saxon.find2">
+      <condition property="saxon9.jar.exists">
         <or>
-          <available file="build/lib/saxon8.jar"/>
-          <available file="${env.XMLBEANS_EXTERNALS}/saxon8.jar"/>
+          <available file="build/lib/saxon9.jar"/>
+          <available file="${env.XMLBEANS_EXTERNALS}/saxon9.jar"/>
         </or>
       </condition>
     </target>
 
-    <target name="saxon8.jar" depends="check.saxon8.jar, dirs"
-        unless="saxon8.jar.exists">
-	<!-- other saxon urls
-		http://voxel.dl.sourceforge.net/sourceforge/saxon/saxonb8-1.zip
-		http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-7-3j.zip
-	-->
-        <get dest="external/lib/saxonb8-8j.zip"
-	    src="http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-8j.zip"
+    <target name="saxon9.jar" depends="check.saxon9.jar, dirs"
+        unless="saxon9.jar.exists">
+        <!-- other saxon urls
+            http://voxel.dl.sourceforge.net/sourceforge/saxon/saxonb8-1.zip
+            http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-7-3j.zip
+            http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-8j.zip
+        -->
+        <get dest="external/lib/saxonb9-0-0-4j.zip"
+            src="http://prdownloads.sourceforge.net/saxon/saxonb9-0-0-4j.zip"
             verbose="true" usetimestamp="true" ignoreerrors="true"/>
-        <unzip src="external/lib/saxonb8-8j.zip" dest="external/lib/">
+        <unzip src="external/lib/saxonb9-0-0-4j.zip" dest="external/lib/">
             <patternset>
-                <include name="saxon8.jar"/>
-                <include name="saxon8-dom.jar"/>
+                <include name="saxon9.jar"/>
+                <include name="saxon9-dom.jar"/>
             </patternset>
         </unzip>
 
-        <copy file="external/lib/saxon8.jar" tofile="build/lib/saxon8.jar"/>
-        <!-- saxon8-dom.jar is used to register DOMObjectModel -->
-        <copy file="external/lib/saxon8-dom.jar" tofile="build/lib/saxon8-dom.jar"/>
+        <copy file="external/lib/saxon9.jar" tofile="build/lib/saxon9.jar"/>
+        <!-- saxon9-dom.jar is used to register DOMObjectModel -->
+        <copy file="external/lib/saxon9-dom.jar" tofile="build/lib/saxon9-dom.jar"/>
     </target>
 
     <target name="jsr173-bundle.downloaded">
@@ -342,15 +346,15 @@
         <mkdir dir="build/private/xmlbeans-${version.base}/lib"/>
         <copy todir="build/private/xmlbeans-${version.base}/lib">
             <fileset dir="build/lib">
-	        <include name="xbean.jar"/>
-	        <include name="xmlpublic.jar"/>
-            <include name="xmlbeans-qname.jar"/>
-	        <include name="xbean_xpath.jar"/>
-	        <include name="resolver.jar"/>
-	        <include name="jsr173_1.0_api.jar"/>
-	        <include name="BEA Binary RI License (JSR 173).1(Clean).txt"/>
-	        <include name="README(jsr_173 api and ri).txt"/>
-	    </fileset>
+                <include name="xbean.jar"/>
+                <include name="xmlpublic.jar"/>
+                <include name="xmlbeans-qname.jar"/>
+                <include name="xbean_xpath.jar"/>
+                <include name="resolver.jar"/>
+                <include name="jsr173_1.0_api.jar"/>
+                <include name="BEA Binary RI License (JSR 173).1(Clean).txt"/>
+                <include name="README(jsr_173 api and ri).txt"/>
+            </fileset>
         </copy>
 
         <mkdir dir="build/private/xmlbeans-${version.base}/docs"/>
@@ -403,7 +407,7 @@
                     includes="bin/**"/>
                 <patternset id="src.dist.content.files"
                     includes="build.xml README.txt xbeanenv.cmd xbeanenv.sh LICENSE.txt NOTICE.txt"/>
-           	    <patternset id="src.dist.content.tests"
+                <patternset id="src.dist.content.tests"
                     includes=""/><!-- don't have tests part of the distribution yet
-->
             </zipfileset>
         </zip>
@@ -480,7 +484,7 @@
         </jar>
         <jar jarfile="build/lib/xmlbeans-qname.jar">
             <fileset dir="build/classes/xmlpublic"
-        	    includes="javax/xml/namespace/QName.class,javax/xml/namespace/NamespaceContext.class"/>
+                includes="javax/xml/namespace/QName.class,javax/xml/namespace/NamespaceContext.class"/>
         </jar>
     </target>
 
@@ -495,7 +499,7 @@
             <classpath>
                 <pathelement location="build/classes/common"/>
             </classpath>
-               </javac>
+        </javac>
     </target>
 
     <!-- xmlpublic target ============================================== -->
@@ -649,7 +653,6 @@
                 <pathelement location="build/classes/xsdschema"/>
             </classpath>
         </javac>
-
     </target>
 
     <!-- marshal target =============================================== -->
@@ -690,7 +693,6 @@
                 <pathelement location="build/classes/xmlpublic"/>
             </classpath>
         </javac>
-
     </target>
 
     <!-- store target ============================================== -->
@@ -709,7 +711,6 @@
                 <pathelement location="build/classes/piccolo"/>
             </classpath>
         </javac>
-
     </target>
 
     <!-- tools target ============================================== -->
@@ -731,7 +732,6 @@
                 <pathelement location="build/classes/xmlcomp"/>
             </classpath>
         </javac>
-
     </target>
 
     <!-- bootstrap schema target support ================================ -->
@@ -745,7 +745,7 @@
     <path id="bootstrap.run.path">
         <pathelement location="build/private/lib/oldxbean.jar"/>
         <pathelement location="build/lib/jsr173_1.0_api.jar"/>
-    	<pathelement location="build/classes/xmlpublic"/>
+        <pathelement location="build/classes/xmlpublic"/>
     </path>
 
     <path id="bootstrap.compile.path">
@@ -813,7 +813,6 @@
                 <pathelement location="build/classes/configschema"/>
             </classpath>
         </javac>
-
     </target>
 
     <!-- configschema target ============================================= -->
@@ -936,7 +935,7 @@
 
     <!-- xpath target ============================================= -->
 
-    <target name="xpath.classes" depends="dirs, xmlpublic.classes, store.classes, saxon8.jar">
+    <target name="xpath.classes" depends="dirs, xmlpublic.classes, store.classes, saxon9.jar">
         <mkdir dir="build/classes/xpath_xquery"/>
         <javac
             destdir="build/classes/xpath_xquery"
@@ -1088,9 +1087,9 @@
             source="1.4" target="1.4"
             debug="on">
             <src path="build/private/jam/src_repackage"/>
-        	<classpath>
-        		<pathelement location="build/lib/jsr173_1.0_api.jar"/>
-        	</classpath>
+            <classpath>
+                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
+            </classpath>
         </javac>
     </target>
 

Modified: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java?rev=648478&r1=648477&r2=648478&view=diff
==============================================================================
--- xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
(original)
+++ xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
Tue Apr 15 17:56:48 2008
@@ -15,43 +15,51 @@
 
 package org.apache.xmlbeans.impl.xpath.saxon;
 
-import org.apache.xmlbeans.impl.store.SaxonXBeansDelegate;
-import org.w3c.dom.Node;
-
 import java.util.List;
 import java.util.Map;
 import java.util.ListIterator;
 
+import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.TransformerException;
 
+import org.w3c.dom.Node;
+
 import net.sf.saxon.Configuration;
-import net.sf.saxon.dom.NodeOverNodeInfo;
+import net.sf.saxon.dom.NodeWrapper;
 import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.om.VirtualNode;
+import net.sf.saxon.om.Item;
+import net.sf.saxon.value.Value;
 import net.sf.saxon.sxpath.XPathEvaluator;
 import net.sf.saxon.sxpath.XPathExpression;
-import net.sf.saxon.trans.Variable;
-
-import javax.xml.transform.dom.DOMSource;
+import net.sf.saxon.sxpath.IndependentContext;
+import net.sf.saxon.sxpath.XPathDynamicContext;
+import net.sf.saxon.sxpath.XPathVariable;
 
+import org.apache.xmlbeans.impl.store.SaxonXBeansDelegate;
 
 public class XBeansXPath
-        implements SaxonXBeansDelegate.SelectPathInterface {
+        implements SaxonXBeansDelegate.SelectPathInterface
+{
+    private Object[] namespaceMap;
+    private String path;
+    private String contextVar;
+    private String defaultNS;
 
     /**
      * Construct given an XPath expression string.
-     * @param xpathExpr The XPath expression.
+     * @param path The XPath expression
      * @param contextVar The name of the context variable
      * @param namespaceMap a map of prefix/uri bindings for NS support
      * @param defaultNS the uri for the default element NS, if any
      */
-    public XBeansXPath(String xpathExpr, String contextVar,
+    public XBeansXPath(String path, String contextVar,
                        Map namespaceMap, String defaultNS)
     {
-        _queryExpr = xpathExpr;
-        _contextVar = contextVar;
+        this.path = path;
+        this.contextVar = contextVar;
         this.defaultNS = defaultNS;
         this.namespaceMap = namespaceMap.entrySet().toArray();
-        this.needsDomSourceWrapping = needsDOMSourceWrapping();
     }
 
     /**
@@ -68,26 +76,26 @@
      * </p>
      * <p/>
      * <p/>
-     * <b>NOTE:</b> Param node must be a Dom node which will be used during the
xpath
-     * execution and iteration through the results. A call of node.dispose() must be done
-     * after reading all results.
+     * <b>NOTE:</b> Param node must be a DOM node which will be used
+     * during the xpath execution and iteration through the results. 
+     * A call of node.dispose() must be done after reading all results.
      * </p>
      *
      * @param node The node, nodeset or Context object for evaluation.
      * This value can be null.
-     * @return The <code>a list</code> of all items selected
+     * @return The <code>List</code> of all items selected
      *         by this XPath expression.
      */
     public List selectNodes(Object node)
     {
         try
         {
-            DOMSource rootNode = new DOMSource((Node) node);
+            Node contextNode = (Node)node;
             XPathEvaluator xpe = new XPathEvaluator();
-            Configuration c = new Configuration();
-            c.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);
-            XBeansIndependentContext sc = new XBeansIndependentContext(c);
-
+            Configuration config = new Configuration();
+            config.setDOMLevel(2);
+            config.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);
+            IndependentContext sc = new IndependentContext(config);
             // Declare ns bindings
             if (defaultNS != null)
                 sc.setDefaultElementNamespace(defaultNS);
@@ -98,26 +106,34 @@
                 sc.declareNamespace((String) entry.getKey(),
                         (String) entry.getValue());
             }
-
             xpe.setStaticContext(sc);
+            XPathVariable thisVar = xpe.declareVariable("", contextVar);
+            XPathExpression xpath = xpe.createExpression(path);
+            NodeInfo contextItem = 
+                //config.buildDocument(new DOMSource(contextNode));
+                config.unravel(new DOMSource(contextNode));
+            XPathDynamicContext dc = xpath.createDynamicContext(null);
+            dc.setContextItem(contextItem);
+            dc.setVariable(thisVar, contextItem);
 
-            Variable thisVar = sc.declareVariable(_contextVar);
-            thisVar.setValue(needsDomSourceWrapping ? rootNode : node);
-
-            XPathExpression exp = xpe.createExpression(_queryExpr);
-
-            // After 8.3(?) Saxon nodes no longer implement Dom.
-            // The client needs saxon8-dom.jar, and the code needs
-            // this NodeOverNodeInfo Dom wrapper doohickey
-            List saxonNodes = exp.evaluate(rootNode);
-            for (ListIterator it = saxonNodes.listIterator(); it.hasNext();)
+            List saxonNodes = xpath.evaluate(dc);
+            for (ListIterator it = saxonNodes.listIterator(); it.hasNext(); )
             {
                 Object o = it.next();
-                if(o instanceof NodeInfo)
+                if (o instanceof NodeInfo)
                 {
-                    Node n = NodeOverNodeInfo.wrap((NodeInfo)o);
-                    it.set(n);
+                    if (o instanceof NodeWrapper)
+                    {
+                        Node n = getUnderlyingNode((NodeWrapper)o);
+                        it.set(n);
+                    }
+                    else
+                    {
+                        it.set(((NodeInfo)o).getStringValue());
+                    }
                 }
+                else if (o instanceof Item)
+                    it.set(Value.convertToJava((Item)o));
             }
             return saxonNodes;
         }
@@ -133,34 +149,25 @@
     }
 
     /**
-     * @return true if we are dealing with a version of Saxon 8.x where x<=6
+     * According to the Saxon javadoc: 
+     * <code>getUnderlyingNode</code> in <code>NodeWrapper</code>
implements 
+     * the method specified in the interface <code>VirtualNode</code>, and
+     * the specification of the latter says that it may return another
+     * <code>VirtualNode</code>, and you may have to drill down through
+     * several layers of wrapping.
+     * To be safe, this method is provided to drill down through multiple
+     * layers of wrapping.
+     * @param v The <code>VirtualNode</code>
+     * @return The underlying node
      */
-    private static boolean needsDOMSourceWrapping()
+    private static Node getUnderlyingNode(VirtualNode v)
     {
-        int saxonMinorVersion;
-        int saxonMajorVersion;
-        String versionString = net.sf.saxon.Version.getProductVersion();
-        int dot1 = versionString.indexOf('.');
-        if (dot1 < 0)
-            return false;
-        int dot2 = versionString.indexOf('.', dot1 + 1);
-        if (dot2 < 0)
-            return false;
-        try
-        {
-            saxonMajorVersion = Integer.parseInt(versionString.substring(0, dot1));
-            saxonMinorVersion = Integer.parseInt(versionString.substring(dot1 + 1, dot2));
-            return saxonMajorVersion == 8 && saxonMinorVersion <= 6;
-        }
-        catch (NumberFormatException nfe)
+        Object o = v;
+        while (o instanceof VirtualNode)
         {
-            return false;
+            o = ((VirtualNode)o).getUnderlyingNode();
         }
+        return (Node)o;
     }
 
-    private boolean needsDomSourceWrapping;
-    private Object[] namespaceMap;
-    private String _queryExpr;
-    private String _contextVar;
-    private String defaultNS;
 }

Modified: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java?rev=648478&r1=648477&r2=648478&view=diff
==============================================================================
--- xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
(original)
+++ xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
Tue Apr 15 17:56:48 2008
@@ -15,102 +15,98 @@
 
 package org.apache.xmlbeans.impl.xquery.saxon;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.TransformerException;
+
+import org.w3c.dom.Node;
+
 import net.sf.saxon.Configuration;
 import net.sf.saxon.dom.NodeOverNodeInfo;
 import net.sf.saxon.om.NodeInfo;
 import net.sf.saxon.query.DynamicQueryContext;
 import net.sf.saxon.query.StaticQueryContext;
 import net.sf.saxon.query.XQueryExpression;
+
 import org.apache.xmlbeans.XmlRuntimeException;
 import org.apache.xmlbeans.XmlTokenSource;
 import org.apache.xmlbeans.impl.store.SaxonXBeansDelegate;
-import org.w3c.dom.Node;
-
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.TransformerException;
-import java.util.List;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.ListIterator;
-
 
 public class XBeansXQuery
         implements SaxonXBeansDelegate.QueryInterface
 {
+    private XQueryExpression xquery;
+    private String contextVar;
+    private Configuration config;
 
     /**
      * Construct given an XQuery expression string.
-     * @param queryExpr The XQuery expression.
+     * @param query The XQuery expression
      * @param contextVar The name of the context variable
      * @param boundary The offset of the end of the prolog
      */
-    public XBeansXQuery(String queryExpr, String contextVar, Integer boundary)
+    public XBeansXQuery(String query, String contextVar, Integer boundary)
     {
-        this.needsDomSourceWrapping = needsDOMSourceWrapping();
-        this.config = new Configuration();
+        config = new Configuration();
+        config.setDOMLevel(2);
         config.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);
-        this._stcContext = new StaticQueryContext(config);
-        this._query = queryExpr;
-        this._contextVar = contextVar;
-        this.boundary = boundary.intValue();
+        StaticQueryContext sc = new StaticQueryContext(config);
+        this.contextVar = contextVar;
+        int bdry = boundary.intValue();
         //Saxon requires external variables at the end of the prolog...
-        String queryExp =
-                (this.boundary == 0) ?
+        query = (bdry == 0) ?
                 "declare variable $" +
-                _contextVar + " external;" + _query :
-                _query.substring(0, this.boundary) +
+                contextVar + " external;" + query :
+                query.substring(0, bdry) +
                 "declare variable $" +
-                _contextVar + " external;" +
-                _query.substring(this.boundary);
-        try {
-            this._xquery = _stcContext.compileQuery(queryExp);
+                contextVar + " external;" +
+                query.substring(bdry);
+        try
+        {
+            xquery = sc.compileQuery(query);
         }
-        catch (TransformerException e) {
+        catch (TransformerException e)
+        {
             throw new XmlRuntimeException(e);
         }
     }
 
     public List execQuery(Object node, Map variableBindings)
     {
-        try {
-            Node context_node = (Node) node;
-            DynamicQueryContext dynamicContext =
-                    new DynamicQueryContext(config);
-            dynamicContext.setContextNode(_stcContext.
-                    buildDocument(new DOMSource(context_node)));
-            dynamicContext.setParameter(_contextVar,
-                    dynamicContext.getContextItem());
+        try
+        {
+            Node contextNode = (Node)node;
+            NodeInfo contextItem = 
+                config.buildDocument(new DOMSource(contextNode));
+                //config.unravel(new DOMSource(contextNode));
+            DynamicQueryContext dc = new DynamicQueryContext(config);
+            dc.setContextItem(contextItem);
+            dc.setParameter(contextVar, contextItem);
             // Set the other variables
             if (variableBindings != null)
+            {
                 for (Iterator it = variableBindings.entrySet().iterator();
                     it.hasNext(); )
                 {
-                    Map.Entry entry = (Map.Entry) it.next();
-                    if (entry.getValue() instanceof XmlTokenSource)
+                    Map.Entry entry = (Map.Entry)it.next();
+                    String key = (String)entry.getKey();
+                    Object value = entry.getValue();
+                    if (value instanceof XmlTokenSource)
                     {
-                        Object paramObject;
-                        // Saxon 8.6.1 requires that the Node be wrapped
-                        // into a DOMSource, while later versions require that
-                        // it not be
-                        if (needsDomSourceWrapping)
-                            paramObject = new DOMSource(((XmlTokenSource)
-                                entry.getValue()).getDomNode());
-                        else
-                            paramObject = ((XmlTokenSource) entry.getValue()).
-                                getDomNode();
-                        dynamicContext.setParameter((String) entry.getKey(),
-                                paramObject);
+                        Node paramObject = ((XmlTokenSource)value).getDomNode();
+                        dc.setParameter(key, paramObject);
                     }
-                    else if (entry.getValue() instanceof String)
-                    dynamicContext.setParameter((String) entry.getKey(),
-                        entry.getValue());
+                    else if (value instanceof String)
+                        dc.setParameter(key, value);
                 }
+            }
 
-            // After 8.3(?) Saxon nodes no longer implement Dom.
-            // The client needs saxon8-dom.jar, and the code needs
-            // this NodeOverNodeInfo Dom wrapper doohickey
-            List saxonNodes = _xquery.evaluate(dynamicContext);
-            for(ListIterator it = saxonNodes.listIterator(); it.hasNext(); )
+            List saxonNodes = xquery.evaluate(dc);
+            for (ListIterator it = saxonNodes.listIterator(); it.hasNext(); )
             {
                 Object o = it.next();
                 if(o instanceof NodeInfo)
@@ -121,42 +117,9 @@
             }
             return saxonNodes;
         }
-        catch (TransformerException e) {
-            throw new RuntimeException(" Error binding " + _contextVar, e);
-        }
-    }
-
-    /**
-     * @return true if we are dealing with a version of Saxon 8.x where x<=6
-     */
-    private static boolean needsDOMSourceWrapping()
-    {
-        int saxonMinorVersion;
-        int saxonMajorVersion;
-        String versionString = net.sf.saxon.Version.getProductVersion();
-        int dot1 = versionString.indexOf('.');
-        if (dot1 < 0)
-            return false;
-        int dot2 = versionString.indexOf('.', dot1 + 1);
-        if (dot2 < 0)
-            return false;
-        try
+        catch (TransformerException e)
         {
-            saxonMajorVersion = Integer.parseInt(versionString.substring(0, dot1));
-            saxonMinorVersion = Integer.parseInt(versionString.substring(dot1 + 1, dot2));
-            return saxonMajorVersion == 8 && saxonMinorVersion <= 6;
-        }
-        catch (NumberFormatException nfe)
-        {
-            return false;
+            throw new RuntimeException("Error binding " + contextVar, e);
         }
     }
-
-    private XQueryExpression _xquery;
-    private String _query;
-    private String _contextVar;
-    private StaticQueryContext _stcContext;
-    private Configuration config;
-    private int boundary;
-    private boolean needsDomSourceWrapping;
 }

Modified: xmlbeans/trunk/testbuild.xml
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/testbuild.xml?rev=648478&r1=648477&r2=648478&view=diff
==============================================================================
--- xmlbeans/trunk/testbuild.xml (original)
+++ xmlbeans/trunk/testbuild.xml Tue Apr 15 17:56:48 2008
@@ -225,10 +225,10 @@
         <pathelement path="${build.dir.test.lib}/testcases.jar"/>
         <pathelement path="${build.dir.test.lib}/testtools.jar"/>
         <pathelement path="${build.lib}/xbean_xpath.jar"/>
-        <pathelement path="${build.lib}/saxon8.jar"/>
-        <pathelement path="${build.lib}/saxon8-dom.jar"/>
-        <pathelement path="${ENV.XMLBEANS_EXTERNALS}/saxon8.jar"/>
-        <pathelement path="${ENV.XMLBEANS_EXTERNALS}/saxon8-dom.jar"/>
+        <pathelement path="${build.lib}/saxon9.jar"/>
+        <pathelement path="${build.lib}/saxon9-dom.jar"/>
+        <pathelement path="${ENV.XMLBEANS_EXTERNALS}/saxon9.jar"/>
+        <pathelement path="${ENV.XMLBEANS_EXTERNALS}/saxon9-dom.jar"/>
         <path refid="build.classpath"/>
         <fileset refid="test.build.jars"/>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message