[pkg-java] r19210 - in trunk/xmlbeans/debian: . patches
Eugene Zhukov
eugene at moszumanska.debian.org
Thu Mar 2 15:43:13 UTC 2017
Author: eugene
Date: 2017-03-02 15:43:13 +0000 (Thu, 02 Mar 2017)
New Revision: 19210
Modified:
trunk/xmlbeans/debian/changelog
trunk/xmlbeans/debian/patches/saxonhe_fixes.patch
Log:
Refresh Saxon-HE patch for 9.7.0.10 version
Modified: trunk/xmlbeans/debian/changelog
===================================================================
--- trunk/xmlbeans/debian/changelog 2017-02-08 20:19:45 UTC (rev 19209)
+++ trunk/xmlbeans/debian/changelog 2017-03-02 15:43:13 UTC (rev 19210)
@@ -1,3 +1,10 @@
+xmlbeans (2.6.0+dfsg-2) UNRELEASED; urgency=medium
+
+ * Team upload.
+ * Refresh patch for Saxon-HE to exclude xpath and xquiery classes.
+
+ -- Eugene Zhukov <eugene at debian.org> Thu, 02 Mar 2017 17:35:21 +0200
+
xmlbeans (2.6.0+dfsg-1) unstable; urgency=medium
* Team upload.
Modified: trunk/xmlbeans/debian/patches/saxonhe_fixes.patch
===================================================================
--- trunk/xmlbeans/debian/patches/saxonhe_fixes.patch 2017-02-08 20:19:45 UTC (rev 19209)
+++ trunk/xmlbeans/debian/patches/saxonhe_fixes.patch 2017-03-02 15:43:13 UTC (rev 19210)
@@ -1,40 +1,306 @@
-Description: Build with Saxon-HE
+Description: Build with Saxon-HE 9.7.0.10
--- a/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
-+++ b/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
-@@ -25,11 +25,11 @@
- import org.w3c.dom.Node;
-
- import net.sf.saxon.Configuration;
++++ /dev/null
+@@ -1,173 +0,0 @@
+-/* 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 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.NodeWrapper;
-+import net.sf.saxon.dom.DOMNodeWrapper;
- import net.sf.saxon.om.NodeInfo;
+-import net.sf.saxon.om.NodeInfo;
-import net.sf.saxon.om.VirtualNode;
-+import net.sf.saxon.tree.wrapper.VirtualNode;
- import net.sf.saxon.om.Item;
+-import net.sf.saxon.om.Item;
-import net.sf.saxon.value.Value;
-+import net.sf.saxon.om.SequenceTool;
- import net.sf.saxon.sxpath.XPathEvaluator;
- import net.sf.saxon.sxpath.XPathExpression;
- import net.sf.saxon.sxpath.IndependentContext;
-@@ -122,9 +122,9 @@
- Object o = it.next();
- if (o instanceof NodeInfo)
- {
+-import net.sf.saxon.sxpath.XPathEvaluator;
+-import net.sf.saxon.sxpath.XPathExpression;
+-import net.sf.saxon.sxpath.IndependentContext;
+-import net.sf.saxon.sxpath.XPathDynamicContext;
+-import net.sf.saxon.sxpath.XPathVariable;
+-
+-import org.apache.xmlbeans.impl.store.PathDelegate;
+-
+-public class XBeansXPath
+- implements PathDelegate.SelectPathInterface
+-{
+- private Object[] namespaceMap;
+- private String path;
+- private String contextVar;
+- private String defaultNS;
+-
+- /**
+- * Construct given an XPath expression string.
+- * @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 path, String contextVar,
+- Map namespaceMap, String defaultNS)
+- {
+- this.path = path;
+- this.contextVar = contextVar;
+- this.defaultNS = defaultNS;
+- this.namespaceMap = namespaceMap.entrySet().toArray();
+- }
+-
+- /**
+- * Select all nodes that are selectable by this XPath
+- * expression. If multiple nodes match, multiple nodes
+- * will be returned.
+- * <p/>
+- * <p/>
+- * <b>NOTE:</b> In most cases, nodes will be returned
+- * in document-order, as defined by the XML Canonicalization
+- * specification. The exception occurs when using XPath
+- * expressions involving the <code>union</code> operator
+- * (denoted with the pipe '|' character).
+- * </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.
+- * </p>
+- *
+- * @param node The node, nodeset or Context object for evaluation.
+- * This value can be null.
+- * @return The <code>List</code> of all items selected
+- * by this XPath expression.
+- */
+- public List selectNodes(Object node)
+- {
+- try
+- {
+- Node contextNode = (Node)node;
+- XPathEvaluator xpe = new XPathEvaluator();
+- 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);
+-
+- for (int i = 0; i < namespaceMap.length; i++)
+- {
+- Map.Entry entry = (Map.Entry) namespaceMap[i];
+- 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);
+-
+- List saxonNodes = xpath.evaluate(dc);
+- for (ListIterator it = saxonNodes.listIterator(); it.hasNext(); )
+- {
+- Object o = it.next();
+- if (o instanceof NodeInfo)
+- {
- if (o instanceof NodeWrapper)
-+ if (o instanceof DOMNodeWrapper)
- {
+- {
- Node n = getUnderlyingNode((NodeWrapper)o);
-+ Node n = getUnderlyingNode((DOMNodeWrapper)o);
- it.set(n);
- }
- else
-@@ -133,7 +133,7 @@
- }
- }
- else if (o instanceof Item)
+- it.set(n);
+- }
+- else
+- {
+- it.set(((NodeInfo)o).getStringValue());
+- }
+- }
+- else if (o instanceof Item)
- it.set(Value.convertToJava((Item)o));
-+ it.set(SequenceTool.convertToJava((Item)o));
- }
- return saxonNodes;
- }
+- }
+- return saxonNodes;
+- }
+- catch (TransformerException e)
+- {
+- throw new RuntimeException(e);
+- }
+- }
+-
+- public List selectPath(Object node)
+- {
+- return selectNodes(node);
+- }
+-
+- /**
+- * 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 Node getUnderlyingNode(VirtualNode v)
+- {
+- Object o = v;
+- while (o instanceof VirtualNode)
+- {
+- o = ((VirtualNode)o).getUnderlyingNode();
+- }
+- return (Node)o;
+- }
+-
+-}
+--- a/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
++++ /dev/null
+@@ -1,125 +0,0 @@
+-/* 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.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.QueryDelegate;
+-
+-public class XBeansXQuery
+- implements QueryDelegate.QueryInterface
+-{
+- private XQueryExpression xquery;
+- private String contextVar;
+- private Configuration config;
+-
+- /**
+- * Construct given an XQuery expression string.
+- * @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 query, String contextVar, Integer boundary)
+- {
+- config = new Configuration();
+- config.setDOMLevel(2);
+- config.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);
+- StaticQueryContext sc = new StaticQueryContext(config);
+- this.contextVar = contextVar;
+- int bdry = boundary.intValue();
+- //Saxon requires external variables at the end of the prolog...
+- query = (bdry == 0) ?
+- "declare variable $" +
+- contextVar + " external;" + query :
+- query.substring(0, bdry) +
+- "declare variable $" +
+- contextVar + " external;" +
+- query.substring(bdry);
+- try
+- {
+- xquery = sc.compileQuery(query);
+- }
+- catch (TransformerException e)
+- {
+- throw new XmlRuntimeException(e);
+- }
+- }
+-
+- public List execQuery(Object node, Map variableBindings)
+- {
+- 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();
+- String key = (String)entry.getKey();
+- Object value = entry.getValue();
+- if (value instanceof XmlTokenSource)
+- {
+- Node paramObject = ((XmlTokenSource)value).getDomNode();
+- dc.setParameter(key, paramObject);
+- }
+- else if (value instanceof String)
+- dc.setParameter(key, value);
+- }
+- }
+-
+- List saxonNodes = xquery.evaluate(dc);
+- for (ListIterator it = saxonNodes.listIterator(); it.hasNext(); )
+- {
+- Object o = it.next();
+- if(o instanceof NodeInfo)
+- {
+- Node n = NodeOverNodeInfo.wrap((NodeInfo)o);
+- it.set(n);
+- }
+- }
+- return saxonNodes;
+- }
+- catch (TransformerException e)
+- {
+- throw new RuntimeException("Error binding " + contextVar, e);
+- }
+- }
+-}
More information about the pkg-java-commits
mailing list