Author: mriou
Date: Thu Sep  7 16:20:47 2006
New Revision: 441296

URL: http://svn.apache.org/viewvc?view=rev&rev=441296
Log:
Saxon only accepts nodelists as variable values, no simple nodes...

Modified:
    
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java
    
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java

Modified: 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java?view=diff&rev=441296&r1=441295&r2=441296
==============================================================================
--- 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java
 (original)
+++ 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpVariableResolver.java
 Thu Sep  7 16:20:47 2006
@@ -29,9 +29,12 @@
 import org.apache.ode.bpel.o.OMessageVarType;
 import org.apache.ode.bpel.o.OScope;
 import org.apache.ode.bpel.o.OXsdTypeVarType;
+import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.Namespaces;
 import org.apache.ode.utils.xsd.XSTypes;
+import org.w3c.dom.Document;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 import javax.xml.namespace.QName;
 import javax.xml.xpath.XPathVariableResolver;
@@ -107,7 +110,12 @@
                     } catch (NumberFormatException e) { }
                     return text;
                 } else {
-                    return variableNode;
+                    System.out.println("############### NODELIST " + 
((NodeList)variableNode).getLength());
+                    // Saxon expects a nodelist, everything will result in a 
wrong result...
+                    Document doc = DOMUtils.newDocument();
+                    doc.appendChild(doc.importNode(variableNode, true));
+                    System.out.println("=> WRAPPED " + doc.getChildNodes() + " 
- " + doc.getChildNodes().getLength());
+                    return doc.getChildNodes();
                 }
             }catch(FaultException e){
                 throw new WrappedResolverException(e);

Modified: 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java?view=diff&rev=441296&r1=441295&r2=441296
==============================================================================
--- 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
 (original)
+++ 
incubator/ode/trunk/bpel-el-xpath20/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
 Thu Sep  7 16:20:47 2006
@@ -118,7 +118,11 @@
         if (someRes instanceof NodeList) {
             NodeList retVal = (NodeList) someRes;
             result = new ArrayList(retVal.getLength());
-            for(int m = 0; m < retVal.getLength(); m++) 
result.add(retVal.item(m));
+            for(int m = 0; m < retVal.getLength(); m++) {
+                Node val = retVal.item(m);
+                if (val.getNodeType() == Node.DOCUMENT_NODE) val = 
((Document)val).getDocumentElement();
+                result.add(val);
+            }
         }
 
         return result;


Reply via email to