You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/11/14 20:40:18 UTC
svn commit: r344185 - in
/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation:
CopletTransformer.java NewEventLinkTransformer.java
Author: cziegeler
Date: Mon Nov 14 11:40:03 2005
New Revision: 344185
URL: http://svn.apache.org/viewcvs?rev=344185&view=rev
Log:
Fix bug in streaming of coplet information
Correctly remove all non html attributes
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java?rev=344185&r1=344184&r2=344185&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java Mon Nov 14 11:40:03 2005
@@ -28,6 +28,7 @@
import org.apache.cocoon.portal.event.impl.CopletJXPathEvent;
import org.apache.cocoon.portal.event.impl.JXPathEvent;
import org.apache.cocoon.xml.AttributesImpl;
+import org.apache.cocoon.xml.XMLUtils;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.excalibur.xml.sax.XMLizable;
import org.xml.sax.Attributes;
@@ -126,13 +127,13 @@
throw new ProcessingException("Attribute "+SELECT_ATTR+" must be spcified.");
}
- CopletInstanceData cid = this.getCopletInstanceData();
+ final CopletInstanceData cid = this.getCopletInstanceData();
- JXPathContext jxpathContext = JXPathContext.newContext( cid );
- Object object = jxpathContext.getValue(expression);
+ final JXPathContext jxpathContext = JXPathContext.newContext( cid );
+ final Object object = jxpathContext.getValue(expression);
- if (object == null) {
- throw new ProcessingException("Could not find value for expression "+expression);
+ if (object != null) {
+ XMLUtils.valueOf(contentHandler, object);
}
} else if (name.equals(LINK_ELEM)) {
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java?rev=344185&r1=344184&r2=344185&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java Mon Nov 14 11:40:03 2005
@@ -17,10 +17,10 @@
import org.apache.cocoon.portal.coplet.CopletInstanceData;
import org.apache.cocoon.portal.event.impl.CopletLinkEvent;
+import org.apache.cocoon.xml.AttributesImpl;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
/**
* This transformer is used to replace links (URIs) from elements
@@ -120,22 +120,11 @@
+ ".");
}
- //remove ATTRIBUTE_ATTR and ELEMENT_ATTR from attributes
- AttributesImpl newAttributes = null;
-
- if (attributes instanceof AttributesImpl) {
- newAttributes = (AttributesImpl) attributes;
- } else {
- newAttributes = new AttributesImpl(attributes);
- }
-
- //always iterate backwards when removing elements!
- for (int i = newAttributes.getLength() - 1; i >= 0; i--) {
- if (ELEMENT_ATTR.equals(attributes.getLocalName(i))
- || ATTRIBUTE_ATTR.equals(attributes.getLocalName(i))) {
- newAttributes.removeAttribute(i);
- }
- }
+ // remove ATTRIBUTE_ATTR, "coplet" and ELEMENT_ATTR from attributes
+ AttributesImpl newAttributes = this.getMutableAttributes(attributes);
+ newAttributes.removeAttribute(ELEMENT_ATTR);
+ newAttributes.removeAttribute(ATTRIBUTE_ATTR);
+ newAttributes.removeAttribute("coplet");
int index = newAttributes.getIndex(attributeName);
String link = newAttributes.getValue(index);