You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2009/08/25 09:48:46 UTC

svn commit: r807508 - /cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/CleaningTransformer.java

Author: reinhard
Date: Tue Aug 25 07:48:46 2009
New Revision: 807508

URL: http://svn.apache.org/viewvc?rev=807508&view=rev
Log:
sync with C22/C21

Modified:
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/CleaningTransformer.java

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/CleaningTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/CleaningTransformer.java?rev=807508&r1=807507&r2=807508&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/CleaningTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/CleaningTransformer.java Tue Aug 25 07:48:46 2009
@@ -24,6 +24,7 @@
 import org.apache.cocoon.sax.AbstractSAXTransformer;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
 
 public class CleaningTransformer extends AbstractSAXTransformer implements CachingPipelineComponent {
 
@@ -51,6 +52,20 @@
     public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
         this.maybeWriteCharacters();
 
+        // remove namespace from attributes
+        AttributesImpl noNamespaceAtts = new AttributesImpl();
+        String attrName;
+        String attrValue;
+        String attrType;
+        for (int i = 0; i < atts.getLength(); i++) {
+            attrName = atts.getLocalName(i);
+            attrValue = atts.getValue(i);
+            attrType = atts.getType(i);
+            if (attrValue != null) {
+                noNamespaceAtts.addAttribute(EMPTY_NS, attrName, attrName, attrType, attrValue);
+            }
+        }
+
         super.startElement(EMPTY_NS, localName, localName, atts);
     }