You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/08/11 19:18:07 UTC

svn commit: r231484 - in /cocoon/trunk/src/java/org/apache/cocoon: transformation/BrowserUpdateTransformer.java xml/NamespacesTable.java xml/RedundantNamespacesFilter.java

Author: sylvain
Date: Thu Aug 11 10:18:02 2005
New Revision: 231484

URL: http://svn.apache.org/viewcvs?rev=231484&view=rev
Log:
Fix bug found when using Ajax

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java
    cocoon/trunk/src/java/org/apache/cocoon/xml/NamespacesTable.java
    cocoon/trunk/src/java/org/apache/cocoon/xml/RedundantNamespacesFilter.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java?rev=231484&r1=231483&r2=231484&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java Thu Aug 11 10:18:02 2005
@@ -41,7 +41,6 @@
         this.locator = locator;
     }
 
-
     public void startDocument() throws SAXException {
         
         if (ajaxRequest) {
@@ -66,8 +65,10 @@
     }
     
     public void startPrefixMapping(String prefix, String uri) throws SAXException {
-        // always let them trough
-        super.startPrefixMapping(prefix, uri);
+        // Passthrough if not in ajax mode or if in a bu:replace
+        if (!this.ajaxRequest || this.replaceDepth > 0) {
+            super.startPrefixMapping(prefix, uri);
+        }
     }
 
     public void startElement(String uri, String loc, String raw, Attributes attrs) throws SAXException {
@@ -142,8 +143,10 @@
     }
 
     public void endPrefixMapping(String prefix) throws SAXException {
-        // always let them trough
-        super.endPrefixMapping(prefix);
+        // Passthrough if not in ajax mode or if in a bu:replace
+        if (!this.ajaxRequest || this.replaceDepth > 0) {
+            super.endPrefixMapping(prefix);
+        }
     }
 
     public void endDocument() throws SAXException {

Modified: cocoon/trunk/src/java/org/apache/cocoon/xml/NamespacesTable.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/xml/NamespacesTable.java?rev=231484&r1=231483&r2=231484&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/xml/NamespacesTable.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/xml/NamespacesTable.java Thu Aug 11 10:18:02 2005
@@ -49,7 +49,7 @@
  *   }
  *
  *   public void endPrefixMapping(String prefix) throws SAXException {
- *       // Ignore, it is handled by the call to leaveScope above.
+ *       namespaces.removeDeclaration(prefix);
  *   }
  * </pre>
  *
@@ -115,7 +115,6 @@
      * @return The removed <code>Declaration</code> or <b>null</b>.
      */
     public Declaration removeDeclaration(String prefix) {
-
         Entry current = this.lastEntry;
         Entry afterCurrent = null;
         while(current != null) {
@@ -138,6 +137,10 @@
                     overrides.overriden = false;
                 }
 
+                if (this.lastEntry == current) {
+                    this.lastEntry = current.previous;
+                }
+
                 return current;
             }
 
@@ -174,7 +177,7 @@
             handler.startPrefixMapping(current.prefix, current.uri);
             current = current.previous;
         }
-        enterScope();
+        this.lastEntry.closedScopes++;
     }
 
     /**

Modified: cocoon/trunk/src/java/org/apache/cocoon/xml/RedundantNamespacesFilter.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/xml/RedundantNamespacesFilter.java?rev=231484&r1=231483&r2=231484&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/xml/RedundantNamespacesFilter.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/xml/RedundantNamespacesFilter.java Thu Aug 11 10:18:02 2005
@@ -73,6 +73,6 @@
     }
 
     public void endPrefixMapping(String prefix) throws SAXException {
-        // Ignore, this is handled in endElement()
+        ns.removeDeclaration(prefix);
     }
 }