[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-cvs
Subject: svn commit: r378309 - in /xmlbeans/trunk: ./
From: radup () apache ! org
Date: 2006-02-16 17:27:05
Message-ID: 20060216172708.40811.qmail () minotaur ! apache ! org
[Download RAW message or body]
Author: radup
Date: Thu Feb 16 09:27:00 2006
New Revision: 378309
URL: http://svn.apache.org/viewcvs?rev=378309&view=rev
Log:
Updating XmlBeans to download and use SaxonB-8.6.1 in place of SaxonB8.1.
Contributed by Lawrence Jones
Added:
xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansIndependentContext.java
Removed:
xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansStandaloneContext.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/viewcvs/xmlbeans/trunk/build.xml?rev=378309&r1=378308&r2=378309&view=diff
==============================================================================
--- xmlbeans/trunk/build.xml (original)
+++ xmlbeans/trunk/build.xml Thu Feb 16 09:27:00 2006
@@ -53,10 +53,13 @@
<target name="clean.jars" description="Delete any downloaded jars and \
accompanying licenses"> <delete>
<fileset dir="external/lib">
+ <include name="saxonb8-6-1.zip"/>
<include name="saxonb8-2.zip"/>
+ <include name="saxonb8-1.zip"/>
<include name="jsr173_1.0_api_bundle.jar"/>
<include name="jsr173_1.0_api.jar"/>
<include name="saxon8.jar"/>
+ <include name="saxon8-dom.jar"/>
<include name="xcresolver.zip"/>
<!-- the entries below are to delete the previous versions of the \
jsr173 jars --> <include name="jsr173.jar"/>
@@ -100,15 +103,21 @@
<!-- other saxon urls
http://voxel.dl.sourceforge.net/sourceforge/saxon/saxonb8-1.zip
-->
- <get dest="external/lib/saxonb8-1.zip"
- src="http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-1.zip"
+ <get dest="external/lib/saxonb8-6-1.zip"
+ src="http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-6-1.zip"
verbose="true" usetimestamp="true" ignoreerrors="true"/>
- <unzip src="external/lib/saxonb8-1.zip" dest="external/lib/">
+ <unzip src="external/lib/saxonb8-6-1.zip" dest="external/lib/">
<patternset>
<include name="saxon8.jar"/>
+ <include name="saxon8-dom.jar"/>
</patternset>
</unzip>
+
<copy file="external/lib/saxon8.jar" tofile="build/lib/saxon8.jar"/>
+
+ <!-- saxon8-dom.jar is used to register DOMObjectModel for use in
+ xpath/xquery checkintest -->
+ <copy file="external/lib/saxon8-dom.jar" tofile="build/lib/saxon8-dom.jar"/>
</target>
<target name="jsr173-bundle.downloaded">
Added: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansIndependentContext.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansIndependentContext.java?rev=378309&view=auto
==============================================================================
--- xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansIndependentContext.java \
(added)
+++ xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansIndependentContext.java \
Thu Feb 16 09:27:00 2006 @@ -0,0 +1,60 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.xpath.saxon;
+
+import net.sf.saxon.trans.IndependentContext;
+import net.sf.saxon.Configuration;
+import net.sf.saxon.om.NamespaceConstant;
+
+/**
+ * Date: Jan 10, 2005
+ * Time: 10:46:59 AM
+ * <p/>
+ * This class is used to circumvent a Saxon limitation,
+ * namely, the lack of a method to set the default element NS
+ */
+public class XBeansIndependentContext extends IndependentContext
+{
+ public XBeansIndependentContext(Configuration c)
+ {
+ super(c);
+ }
+
+ public XBeansIndependentContext()
+ {
+ super();
+ }
+
+ public void setDefaultElementNamespace(String uri)
+ {
+ defaultUri = true;
+ defaultNSCode = this.getNamePool().allocateCodeForURI(uri);
+ }
+
+ public short getDefaultElementNamespace()
+ {
+ short result = super.getDefaultElementNamespace();
+ if (result == NamespaceConstant.NULL_CODE
+ && defaultUri)
+ return (short) defaultNSCode;
+
+ else
+ return result;
+ }
+
+ private int defaultNSCode;
+ private boolean defaultUri;
+}
Modified: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java?rev=378309&r1=378308&r2=378309&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 \
Thu Feb 16 09:27:00 2006 @@ -21,12 +21,11 @@
import java.util.List;
import java.util.Map;
-import net.sf.saxon.query.*;
-import net.sf.saxon.Configuration;
-import net.sf.saxon.om.NodeInfo;
-import net.sf.saxon.xpath.XPathException;
-import net.sf.saxon.xpath.XPathEvaluator;
-import net.sf.saxon.xpath.StandaloneContext;
+import javax.xml.transform.TransformerException;
+
+import net.sf.saxon.sxpath.XPathEvaluator;
+import net.sf.saxon.sxpath.XPathExpression;
+import net.sf.saxon.trans.Variable;
import javax.xml.transform.dom.DOMSource;
@@ -75,12 +74,9 @@
{
try
{
- DOMSource rootNode =new DOMSource((Node) node);
+ DOMSource rootNode = new DOMSource((Node) node);
XPathEvaluator xpe = new XPathEvaluator();
- NodeInfo _theNode = xpe.setSource(rootNode);
- XBeansStandaloneContext sc = new XBeansStandaloneContext();
- sc.declareVariable("this",_theNode);
- xpe.setStaticContext(sc);
+ XBeansIndependentContext sc = new XBeansIndependentContext();
// Declare ns bindings
if (defaultNS != null)
@@ -92,9 +88,16 @@
sc.declareNamespace((String) entry.getKey(),
(String) entry.getValue());
}
- return xpe.evaluate(_queryExp);
+
+ xpe.setStaticContext(sc);
+
+ Variable thisVar = sc.declareVariable("this");
+ thisVar.setValue(rootNode);
+
+ XPathExpression exp = xpe.createExpression(_queryExp);
+ return exp.evaluate(rootNode);
}
- catch (XPathException e)
+ catch (TransformerException e)
{
throw new RuntimeException(e);
}
@@ -105,7 +108,7 @@
return selectNodes(node);
}
- private Object[] namespaceMap;
+ private Object[] namespaceMap;
private String _queryExp;
- private String defaultNS;
+ private String defaultNS;
}
Modified: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java?rev=378309&r1=378308&r2=378309&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 \
Thu Feb 16 09:27:00 2006 @@ -19,13 +19,12 @@
import net.sf.saxon.query.DynamicQueryContext;
import net.sf.saxon.query.StaticQueryContext;
import net.sf.saxon.query.XQueryExpression;
-import net.sf.saxon.xpath.StaticError;
-import net.sf.saxon.xpath.XPathException;
import org.apache.xmlbeans.XmlRuntimeException;
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;
@@ -58,7 +57,7 @@
try {
this._xquery = _stcContext.compileQuery(queryExp);
}
- catch (XPathException e) {
+ catch (TransformerException e) {
throw new XmlRuntimeException(e);
}
}
@@ -75,11 +74,8 @@
dynamicContext.getContextNode());
return _xquery.evaluate(dynamicContext);
}
- catch (StaticError e) {
- throw new RuntimeException(" Error binding " + _contextVar);
- }
- catch (XPathException e) {
- throw new RuntimeException(e);
+ catch (TransformerException e) {
+ throw new RuntimeException(" Error binding " + _contextVar, e);
}
}
Modified: xmlbeans/trunk/testbuild.xml
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/testbuild.xml?rev=378309&r1=378308&r2=378309&view=diff
==============================================================================
--- xmlbeans/trunk/testbuild.xml (original)
+++ xmlbeans/trunk/testbuild.xml Thu Feb 16 09:27:00 2006
@@ -226,7 +226,9 @@
<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"/>
<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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic