cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r306628 - in /cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup: LogicsheetFilter.java xsp/XSPExpressionFilter.java xsp/XSPMarkupLanguage.java
Date Thu, 06 Oct 2005 13:11:00 GMT
Author: vgritsenko
Date: Thu Oct  6 06:10:50 2005
New Revision: 306628

URL: http://svn.apache.org/viewcvs?rev=306628&view=rev
Log:
regression: algorithm creating logicsheet application order was broken

Modified:
    cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/LogicsheetFilter.java
    cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPExpressionFilter.java
    cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java

Modified: cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/LogicsheetFilter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/LogicsheetFilter.java?rev=306628&r1=306627&r2=306628&view=diff
==============================================================================
--- cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/LogicsheetFilter.java
(original)
+++ cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/LogicsheetFilter.java
Thu Oct  6 06:10:50 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2005 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,17 +22,15 @@
 import java.util.Map;
 
 /**
- * This filter listen for source SAX events, and register the declared
+ * This filter listen for source SAX events, and registers all declared
  * namespaces into a <code>Map</code> object.
  *
  * @see org.xml.sax.XMLFilter
  * @see org.xml.sax.ContentHandler
- * @version SVN $Id$
+ * @version $Id$
  */
-public class LogicsheetFilter
-    extends XMLFilterImpl
-{
-    private Map originalNamepaceURIs;
+public class LogicsheetFilter extends XMLFilterImpl {
+    private Map namespaces;
 
     /**
      * The filter needs an initialized <code>Map</code> object where it
@@ -40,7 +38,7 @@
      * @param originalNamepaceURIs a initialized <code>Map</code> instance.
      */
     public void setNamespaceMap(Map originalNamepaceURIs) {
-        this.originalNamepaceURIs = originalNamepaceURIs;
+        this.namespaces = originalNamepaceURIs;
     }
 
     public void setParent(XMLReader reader) {
@@ -49,9 +47,10 @@
     }
 
     public void startPrefixMapping(String prefix, String uri)
-        throws SAXException
-    {
-        originalNamepaceURIs.put(uri, prefix);
+    throws SAXException {
+        if (namespaces != null) {
+            namespaces.put(uri, prefix);
+        }
         super.startPrefixMapping(prefix, uri);
     }
 }

Modified: cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPExpressionFilter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPExpressionFilter.java?rev=306628&r1=306627&r2=306628&view=diff
==============================================================================
--- cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPExpressionFilter.java
(original)
+++ cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPExpressionFilter.java
Thu Oct  6 06:10:50 2005
@@ -21,29 +21,28 @@
 import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.cocoon.xml.XMLConsumer;
 import org.apache.cocoon.xml.XMLUtils;
+
 import org.apache.commons.lang.StringUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
-import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.ext.LexicalHandler;
 import org.xml.sax.helpers.XMLFilterImpl;
+
 import java.util.LinkedList;
 
 /**
  * Filter attributes and text and expand {#expr} to xsp:attribute and xsp:expr
  * elements.
  *
- * @version SVN $Id$
+ * @version $Id$
  */
-public class XSPExpressionFilter
-    extends LogicsheetFilter
-    implements XSPExpressionParser.Handler {
+public class XSPExpressionFilter extends LogicsheetFilter
+                                 implements XSPExpressionParser.Handler {
 
     public static class XMLPipeAdapter extends AbstractXMLPipe {
         private XSPExpressionFilter expressionFilter;
-
         private AbstractXMLPipe additionalFilter;
 
         public XMLPipeAdapter(XSPExpressionFilter expressionFilter, AbstractXMLPipe additionalFilter)
{
@@ -83,7 +82,7 @@
     /** The parser for XSP value templates */
     private XSPExpressionParser expressionParser = new XSPExpressionParser(this);
 
-    private ContentHandler contentHandler;
+
 
     public XSPExpressionFilter(XSPMarkupLanguage markup) {
         this.markupURI = markup.getURI();
@@ -95,32 +94,24 @@
                                         markup.hasTextInterpolation());
     }
 
-    public void setContentHandler(ContentHandler contentHandler) {
-        this.contentHandler = contentHandler;
-    }
-
     /**
      * Create a new <code>{@link XSPExpressionFilter}</code>.
-     * 
-     * @param filter
-     * @param filename
-     * @param language
      */
     public void startDocument() throws SAXException {
         interpolationStack.clear();
         interpolationStack.addLast(defaultInterpolationSettings);
-        contentHandler.startDocument();
+        super.startDocument();
     }
 
     /**
      * Start a new element. If attribute value templates are enabled and the element has
attributes
      * with templates, these are replaced by xsp:attribute tags.
-     * 
-     * @see org.xml.sax.contentHandler.#startElement(java.lang.String, java.lang.String,
+     *
+     * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String,
      *      java.lang.String, org.xml.sax.Attributes)
      */
     public void startElement(String namespaceURI, String localName, String qName, Attributes
attribs)
-            throws SAXException {
+    throws SAXException {
         expressionParser.flush();
 
         // Check template for interpolation flags
@@ -148,7 +139,7 @@
             }
 
             // Start the element with template-free attributes
-            contentHandler.startElement(namespaceURI, localName, qName, staticAttribs);
+            super.startElement(namespaceURI, localName, qName, staticAttribs);
 
             // Generate xsp:attribute elements for the attributes containing templates
             for (int i = 0; i < dynamicAttribs.getLength(); ++i) {
@@ -163,17 +154,14 @@
 
                 addAttribute(elemAttribs, "name", dynamicAttribs.getLocalName(i));
 
-                contentHandler.startElement(markupURI, "attribute", markupPrefix + ":attribute",
elemAttribs);
-
+                super.startElement(markupURI, "attribute", markupPrefix + ":attribute", elemAttribs);
                 expressionParser.consume(dynamicAttribs.getValue(i));
                 expressionParser.flush();
-
-                contentHandler.endElement(markupURI, "attribute", markupPrefix + ":attribute");
+                super.endElement(markupURI, "attribute", markupPrefix + ":attribute");
             }
-        }
-        else {
+        } else {
             // Attribute value templates disabled => pass through element
-            contentHandler.startElement(namespaceURI, localName, qName, attribs);
+            super.startElement(namespaceURI, localName, qName, attribs);
         }
     }
 
@@ -221,7 +209,7 @@
      */
     public void endElement(String uri, String loc, String raw) throws SAXException {
         expressionParser.flush();
-        contentHandler.endElement(uri, loc, raw);
+        super.endElement(uri, loc, raw);
 
         // Pop stack of interpolation settings.
         interpolationStack.removeLast();
@@ -230,8 +218,8 @@
     /**
      * Handle characters. If text templates are enabled, the text is parsed and expressions
are
      * replaced.
-     * 
-     * @see org.xml.sax.contentHandler.#characters(char[], int, int)
+     *
+     * @see org.xml.sax.ContentHandler#characters(char[], int, int)
      */
     public void characters(char[] ch, int start, int length) throws SAXException {
         if (getInterpolationSettings().textInterpolation) {
@@ -240,35 +228,35 @@
         }
         else {
             // Text templates disabled => pass through text
-            contentHandler.characters(ch, start, length);
+            super.characters(ch, start, length);
         }
     }
 
     /**
      * Forward text to parent class.
-     * 
+     *
      * @see org.apache.cocoon.components.language.markup.xsp.XSPExpressionParser.Handler#handleText(char[],
      *      int, int)
      */
     public void handleText(char[] chars, int start, int length) throws SAXException {
-        contentHandler.characters(chars, start, length);
+        super.characters(chars, start, length);
     }
 
     /**
      * Wrap expressions in xsp:expr tags.
-     * 
+     *
      * @see org.apache.cocoon.components.language.markup.xsp.XSPExpressionParser.Handler#handleExpression(char[],
      *      int, int)
      */
     public void handleExpression(char[] chars, int start, int length) throws SAXException
{
-        contentHandler.startElement(markupURI, "expr", markupPrefix + ":expr", XMLUtils.EMPTY_ATTRIBUTES);
-        contentHandler.characters(chars, start, length);
-        contentHandler.endElement(markupURI, "expr", markupPrefix + ":expr");
+        super.startElement(markupURI, "expr", markupPrefix + ":expr", XMLUtils.EMPTY_ATTRIBUTES);
+        super.characters(chars, start, length);
+        super.endElement(markupURI, "expr", markupPrefix + ":expr");
     }
 
     /**
      * Add an attribute if it is neither <code>null</code> nor empty (length
0).
-     * 
+     *
      * @param attribs The attributes
      * @param name The attribute name
      * @param value The attribute value
@@ -279,34 +267,6 @@
         }
     }
 
-    public void setDocumentLocator(Locator locator) {
-        contentHandler.setDocumentLocator(locator);
-    }
-
-    public void endDocument() throws SAXException {
-        contentHandler.endDocument();
-    }
-
-    public void endPrefixMapping(String prefix) throws SAXException {
-        contentHandler.endPrefixMapping(prefix);
-    }
-
-    public void ignorableWhitespace(char[] chars, int start, int length) throws SAXException
{
-        contentHandler.ignorableWhitespace(chars, start, length);
-    }
-
-    public void processingInstruction(String target, String data) throws SAXException {
-        contentHandler.processingInstruction(target, data);
-    }
-
-    public void skippedEntity(String name) throws SAXException {
-        contentHandler.skippedEntity(name);
-    }
-
-    public void startPrefixMapping(String prefix, String uri) throws SAXException {
-        contentHandler.startPrefixMapping(prefix, uri);
-    }
-
     /**
      * Return current interpolation settings.
      */
@@ -317,8 +277,7 @@
     /**
      * Structure to hold settings for attribute and text interpolation.
      */
-    private static class InterpolationSettings
-    {
+    private static class InterpolationSettings {
         boolean attrInterpolation;
         boolean textInterpolation;
 

Modified: cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java?rev=306628&r1=306627&r2=306628&view=diff
==============================================================================
--- cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java
(original)
+++ cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/markup/xsp/XSPMarkupLanguage.java
Thu Oct  6 06:10:50 2005
@@ -67,8 +67,7 @@
      */
     protected AbstractXMLPipe getPreprocessFilter(String filename,
                                                   AbstractXMLPipe filter,
-                                                  ProgrammingLanguage language)
-    {
+                                                  ProgrammingLanguage language) {
         PreProcessFilter prefilter = new PreProcessFilter(filter, filename, language, this);
         prefilter.enableLogging(getLogger());
         return prefilter;
@@ -81,7 +80,7 @@
     /**
      * <code>{@link CocoonMarkupLanguage.PreProcessFilter PreProcessFilter}</code>
that replaces
      * XSP expressions.
-     * 
+     *
      * @see org.xml.sax.ContentHandler
      */
     protected class PreProcessFilter extends CocoonMarkupLanguage.PreProcessFilter {



Mime
View raw message