cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject svn commit: rev 43685 - cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding
Date Fri, 10 Sep 2004 19:11:19 GMT
Author: tim
Date: Fri Sep 10 12:11:18 2004
New Revision: 43685

Modified:
   cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
Log:
Fix TempRepeaterBinding's virtual-rows to not forget namespaces.
(Step 2: also fix the "save" direction.)


Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
Fri Sep 10 12:11:18 2004
@@ -22,6 +22,7 @@
 import org.apache.cocoon.forms.formmodel.Widget;
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
+import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
@@ -136,10 +137,10 @@
                     Node virtualNode = repeaterNode.getOwnerDocument().createElementNS(null,
"virtual");
                     Node node = (Node)rowPointer.getNode();
                     Node clone = node.cloneNode(true);
-                    Node docElement = node.getOwnerDocument().getDocumentElement().cloneNode(false);
+                    Node fakeDocElement = node.getOwnerDocument().getDocumentElement().cloneNode(false);
                     virtualNode.appendChild(clone);
-                    docElement.appendChild(virtualNode);
-                    rowContext = JXPathContext.newContext(repeaterContext, docElement);
+                    fakeDocElement.appendChild(virtualNode);
+                    rowContext = JXPathContext.newContext(repeaterContext, fakeDocElement);
                     rowContext = rowContext.getRelativeContext(rowContext.getPointer("virtual"));
                 }
 
@@ -194,8 +195,12 @@
                         // narrow the context to this initially empty new virtual row.
                         if (virtualRows == true) {
                             rowNode = (Node)rowContext.getContextBean();
-                            virtualNode = rowNode.getOwnerDocument().createElementNS(null,
"virtual");
-                            rowContext = JXPathContext.newContext(repeaterContext, virtualNode);
+                            Document document = rowNode.getOwnerDocument();
+                            virtualNode = document.createElementNS(null, "virtual");
+                            Node fakeDocElement = document.getDocumentElement().cloneNode(false);
+                            fakeDocElement.appendChild(virtualNode);
+                            rowContext = JXPathContext.newContext(repeaterContext, fakeDocElement);
+                            rowContext = rowContext.getRelativeContext(rowContext.getPointer("virtual"));
                         }
 
                         // Perform the insert row binding

Mime
View raw message