cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject svn commit: r688858 - in /cocoon: branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/ trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/
Date Mon, 25 Aug 2008 20:08:59 GMT
Author: jasha
Date: Mon Aug 25 13:08:58 2008
New Revision: 688858

URL: http://svn.apache.org/viewvc?rev=688858&view=rev
Log:
COCOON-2228 StripNameSpacesTransformer does not strip namespace prefix of attributes

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java?rev=688858&r1=688857&r2=688858&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java
Mon Aug 25 13:08:58 2008
@@ -23,6 +23,7 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.caching.CacheableProcessingComponent;
 import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.excalibur.source.SourceValidity;
 import org.apache.excalibur.source.impl.validity.NOPValidity;
 import org.xml.sax.Attributes;
@@ -65,8 +66,22 @@
 
 	public void startElement(String uri, String localName, String qName,
 			Attributes attr) throws SAXException {
-		
-		super.startElement(EMPTY_NS, localName, localName, attr);
+	    
+	    AttributesImpl l_attr = new AttributesImpl(attr);
+
+        String attrName;
+        String attrValue;
+        String attrType;
+        for (int i = 0; i < attr.getLength(); i++) {
+            attrName = l_attr.getLocalName(i);
+            attrValue = l_attr.getValue(i);
+            attrType = l_attr.getType(i);
+            if (attrValue != null) {
+                l_attr.removeAttribute(i);
+                l_attr.addAttribute(EMPTY_NS, attrName, attrName, attrType, attrValue);
+            }
+        }
+		super.startElement(EMPTY_NS, localName, localName, l_attr);
 
 	}
 

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java?rev=688858&r1=688857&r2=688858&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java
(original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/StripNameSpacesTransformer.java
Mon Aug 25 13:08:58 2008
@@ -24,6 +24,7 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.caching.CacheableProcessingComponent;
 import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.excalibur.source.SourceValidity;
 import org.apache.excalibur.source.impl.validity.NOPValidity;
 import org.xml.sax.Attributes;
@@ -76,7 +77,22 @@
 
     public void startElement(String uri, String localName, String qName, Attributes attr)
     throws SAXException {
-        super.startElement(EMPTY_NS, localName, localName, attr);
+	    
+	    AttributesImpl l_attr = new AttributesImpl(attr);
+
+        String attrName;
+        String attrValue;
+        String attrType;
+        for (int i = 0; i < attr.getLength(); i++) {
+            attrName = l_attr.getLocalName(i);
+            attrValue = l_attr.getValue(i);
+            attrType = l_attr.getType(i);
+            if (attrValue != null) {
+                l_attr.removeAttribute(i);
+                l_attr.addAttribute(EMPTY_NS, attrName, attrName, attrType, attrValue);
+            }
+        }
+        super.startElement(EMPTY_NS, localName, localName, l_attr);
     }
 
     public void endElement(String uri, String localName, String qName)



Mime
View raw message