cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r329457 - in /cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal: layout/renderer/aspect/impl/ pluto/adapter/ util/ wsrp/adapter/
Date Sat, 29 Oct 2005 17:55:05 GMT
Author: cziegeler
Date: Sat Oct 29 10:53:10 2005
New Revision: 329457

URL: http://svn.apache.org/viewcvs?rev=329457&view=rev
Log:
Filter html and body element created by html parser

Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/HtmlSaxParser.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java?rev=329457&r1=329456&r2=329457&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
Sat Oct 29 10:53:10 2005
@@ -38,7 +38,6 @@
     private Iterator iterator;
     private Iterator configIterator;
     private Object config;
-    private Map attributes;
     private Map objectModel;
 
     public DefaultRendererContext(RendererAspectChain chain) {
@@ -66,37 +65,6 @@
 	public Object getAspectConfiguration() {
 		return this.config;
 	}
-
-    /**
-     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext#setAttribute(java.lang.String,
java.lang.Object)
-     */
-    public void setAttribute(String key, Object attribute) {
-        if ( key != null ) {
-            if ( this.attributes == null ) {
-                this.attributes = new HashMap(10); 
-            }
-            this.attributes.put( key, attribute );
-        }
-    }
-
-    /**
-     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext#getAttribute(java.lang.String)
-     */
-    public Object getAttribute(String key) {
-        if ( key != null && this.attributes != null) {
-            return this.attributes.get( key );
-        }
-        return null;
-    }
-
-    /**
-     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext#removeAttribute(java.lang.String)
-     */
-    public void removeAttribute(String key) {
-        if ( this.attributes != null && key != null) {
-            this.attributes.remove( key );
-        }
-    }
 
     /**
      * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext#getObjectModel()

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java?rev=329457&r1=329456&r2=329457&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
Sat Oct 29 10:53:10 2005
@@ -68,7 +68,7 @@
             XMLUtils.startElement(contenthandler, config.tagName);
         }
         XMLUtils.createElement(contenthandler, "title", copletInstanceData.getTitle());
-        XMLUtils.createElement(contenthandler , "instance-id", copletInstanceData.getId());
+        XMLUtils.createElement(contenthandler, "instance-id", copletInstanceData.getId());
 
         context.invokeNext( layout, service, contenthandler );
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java?rev=329457&r1=329456&r2=329457&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
Sat Oct 29 10:53:10 2005
@@ -191,7 +191,7 @@
 
             final Boolean usePipeline = (Boolean)this.getConfiguration(coplet, "use-pipeline",
Boolean.FALSE);
             if ( usePipeline.booleanValue() ) {
-                HtmlSaxParser.parseString(value, contentHandler);
+                HtmlSaxParser.parseString(value, HtmlSaxParser.getContentFilter(contentHandler));
             } else {
                 // stream out the include for the serializer
                 IncludingHTMLSerializer.addPortlet(portlet, value);

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/HtmlSaxParser.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/HtmlSaxParser.java?rev=329457&r1=329456&r2=329457&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/HtmlSaxParser.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/HtmlSaxParser.java Sat Oct
29 10:53:10 2005
@@ -20,8 +20,11 @@
 import java.util.Iterator;
 import java.util.Properties;
 
+import org.apache.cocoon.xml.ContentHandlerWrapper;
+import org.apache.excalibur.xml.sax.XMLConsumer;
 import org.apache.xerces.parsers.AbstractSAXParser;
 import org.cyberneko.html.HTMLConfiguration;
+import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -66,6 +69,37 @@
         } catch (IOException ioe) {
             throw new SAXException("Error during parsing of html markup.", ioe);
         }
-        
+    }
+
+    public static XMLConsumer getContentFilter(ContentHandler ch) {
+        return new ContentFilter(ch);
+    }
+
+    protected static final class ContentFilter extends ContentHandlerWrapper {
+
+        public ContentFilter(ContentHandler ch) {
+            this.setContentHandler(ch);
+            if ( ch instanceof LexicalHandler ) {
+                this.setLexicalHandler((LexicalHandler)ch);
+            }
+        }
+
+        /**
+         * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String,
java.lang.String)
+         */
+        public void endElement(String uri, String loc, String raw) throws SAXException {
+            if ( !loc.equals("html") && !loc.equals("body") ) {
+                super.endElement(uri, loc, raw);
+            }
+        }
+
+        /**
+         * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String,
java.lang.String, org.xml.sax.Attributes)
+         */
+        public void startElement(String uri, String loc, String raw, Attributes a) throws
SAXException {
+            if ( !loc.equals("html") && !loc.equals("body") ) {
+                super.startElement(uri, loc, raw, a);
+            }
+        }
     }
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java?rev=329457&r1=329456&r2=329457&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
Sat Oct 29 10:53:10 2005
@@ -437,7 +437,7 @@
                 if ( usesGet ) {
                     contentHandler = new FormRewritingHandler(contentHandler);
                 }
-                HtmlSaxParser.parseString(content, contentHandler);
+                HtmlSaxParser.parseString(content, HtmlSaxParser.getContentFilter(contentHandler));
             } else {
                 // stream out the include for the serializer
                 IncludingHTMLSerializer.addPortlet(portletInstanceKey, content);



Mime
View raw message