You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/04/26 18:07:05 UTC

svn commit: r164808 [3/3] - in /cocoon/branches/BRANCH_2_1_X/src: blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context/ blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/ blocks/chaperon/java/org/apache/cocoon/transformation/ blocks/forms/java/org/apache/cocoon/forms/datatype/ blocks/mail/java/org/apache/cocoon/generation/ blocks/mail/java/org/apache/cocoon/mail/ blocks/ojb/java/org/apache/cocoon/ojb/components/ blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/ blocks/portal/java/org/apache/cocoon/portal/tools/generation/ blocks/profiler/java/org/apache/cocoon/generation/ blocks/proxy/java/org/apache/cocoon/generation/ blocks/qdox/java/org/apache/cocoon/components/source/impl/ blocks/repository/java/org/apache/cocoon/components/source/helpers/ blocks/repository/java/org/apache/cocoon/generation/ blocks/slop/java/org/apache/cocoon/slop/parsing/ blocks/web3/java/org/apache/cocoon/components/web3/impl/ blocks/webdav/java/org/apache/cocoon/components/source/impl/ blocks/webdav/java/org/apache/cocoon/transformation/ blocks/woody/java/org/apache/cocoon/woody/ blocks/xsp/java/org/apache/cocoon/components/language/markup/ blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/ deprecated/java/org/apache/cocoon/transformation/ java/org/apache/cocoon/components/notification/ java/org/apache/cocoon/generation/ java/org/apache/cocoon/serialization/ java/org/apache/cocoon/sitemap/ java/org/apache/cocoon/transformation/ java/org/apache/cocoon/xml/dom/ samples/org/apache/cocoon/samples/errorhandling/ samples/org/apache/cocoon/samples/parentcm/

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/SessionAttributeGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/SessionAttributeGenerator.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/SessionAttributeGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/SessionAttributeGenerator.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * 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.
@@ -33,12 +33,12 @@
 
 /**
  * @cocoon.sitemap.component.documentation
- * Generates a document from a session attribute. 
- * 
+ * Generates a document from a session attribute.
+ *
  * @cocoon.sitemap.component.name   sessionattribute
  * @cocoon.sitemap.component.label  content
  * @cocoon.sitemap.component.logger sitemap.generator.sessionattribute
- * 
+ *
  * Generates a document from a session attribute. The attribute may be a DOM
  * node, an <code>XMLizable</code>, or any other object, and is streamed using
  * the same rules as for &lt;xsp:expr&gt; in XSPs (see {@link
@@ -73,7 +73,7 @@
  * @see org.apache.cocoon.transformation.WriteDOMSessionTransformer
  * @author <a href="mailto:cedric.damioli@anyware-tech.com">C&eacute;dric Damioli</a>
  * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
- * @version CVS $Id$
+ * @version $Id$
  */
 public class SessionAttributeGenerator extends AbstractGenerator {
 
@@ -91,12 +91,12 @@
      */
     public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
       throws ProcessingException, SAXException, IOException {
-        
+
         super.setup(resolver, objectModel, src, par);
-        
+
         // Get the element name (can be null if the object is a DOM or an XMLizable)
         this.elementName = par.getParameter(ELEMENT_NAME, null);
-        
+
         // Get the attribute name
         String attrName = par.getParameter(ATTR_NAME, src);
         if (attrName == null) {
@@ -111,7 +111,7 @@
         if (session != null) {
             this.attrObject = session.getAttribute(attrName);
         }
-        
+
         // Controls
         if (this.attrObject == null) {
             if (this.elementName == null) {
@@ -132,7 +132,7 @@
                 ! (this.attrObject instanceof XMLizable) &&
                 ! (this.attrObject instanceof Node)) {
 
-                String msg = "Session attribute '" + attrName + "' needs an enclosing element : class is " + 
+                String msg = "Session attribute '" + attrName + "' needs an enclosing element : class is " +
                     this.attrObject.getClass().getName();
 
                 getLogger().warn(msg);
@@ -144,17 +144,18 @@
     /**
      * Generate XML data
      */
-    public void generate() throws IOException, SAXException, ProcessingException {
+    public void generate()
+    throws IOException, SAXException, ProcessingException {
         xmlConsumer.startDocument();
 
         if (this.elementName != null) {
-            xmlConsumer.startElement("", this.elementName, this.elementName, new AttributesImpl());
+            xmlConsumer.startElement("", this.elementName, this.elementName, XMLUtils.EMPTY_ATTRIBUTES);
             XMLUtils.valueOf(new IncludeXMLConsumer(xmlConsumer), this.attrObject);
             xmlConsumer.endElement("", this.elementName, this.elementName);
         } else {
             XMLUtils.valueOf(new IncludeXMLConsumer(xmlConsumer), this.attrObject);
         }
-        
+
         xmlConsumer.endDocument();
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StatusGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StatusGenerator.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StatusGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/StatusGenerator.java Tue Apr 26 09:07:03 2005
@@ -28,6 +28,8 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.Constants;
+import org.apache.cocoon.xml.XMLUtils;
+
 import org.apache.commons.lang.SystemUtils;
 import org.apache.excalibur.store.Store;
 import org.apache.excalibur.store.StoreJanitor;
@@ -338,7 +340,7 @@
         AttributesImpl ai = (atts == null) ? new AttributesImpl() : new AttributesImpl(atts);
         ai.addAttribute(namespace, "name", "name", "CDATA", name);
         ch.startElement(namespace, "value", "value", ai);
-        ch.startElement(namespace, "line", "line", new AttributesImpl());
+        ch.startElement(namespace, "line", "line", XMLUtils.EMPTY_ATTRIBUTES);
 
         if (value != null) {
             ch.characters(value.toCharArray(), 0, value.length());
@@ -364,7 +366,7 @@
         for (int i = 0; i < values.size(); i++) {
             String value = (String) values.get(i);
             if (value != null) {
-                ch.startElement(namespace, "line", "line", new AttributesImpl());
+                ch.startElement(namespace, "line", "line", XMLUtils.EMPTY_ATTRIBUTES);
                 ch.characters(value.toCharArray(), 0, value.length());
                 ch.endElement(namespace, "line", "line");
             }

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java Tue Apr 26 09:07:03 2005
@@ -27,6 +27,8 @@
 import org.apache.cocoon.util.TraxErrorHandler;
 import org.apache.cocoon.xml.AbstractXMLPipe;
 import org.apache.cocoon.xml.XMLConsumer;
+import org.apache.cocoon.xml.XMLUtils;
+
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.excalibur.source.SourceValidity;
 import org.apache.excalibur.source.impl.validity.NOPValidity;
@@ -326,7 +328,7 @@
             // Output a single element
             handler.startDocument();
             handler.startPrefixMapping(prefix, uri);
-            handler.startElement(uri, "element", "", new AttributesImpl());
+            handler.startElement(uri, "element", "", XMLUtils.EMPTY_ATTRIBUTES);
             handler.endPrefixMapping(prefix);
             handler.endDocument();
 

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/TextSerializer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/TextSerializer.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/TextSerializer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/TextSerializer.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * 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.
@@ -18,6 +18,8 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.cocoon.CascadingIOException;
+import org.apache.cocoon.xml.XMLUtils;
+
 import org.xml.sax.SAXException;
 import org.xml.sax.Attributes;
 import org.xml.sax.helpers.AttributesImpl;
@@ -38,7 +40,7 @@
  * should wrap all the text inside it.
  *
  * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Id: TextSerializer.java,v 1.3 2004/03/05 13:02:58 bdelacretaz Exp $
+ * @version $Id$
  */
 public class TextSerializer extends AbstractTextSerializer {
 
@@ -73,23 +75,23 @@
             this.setContentHandler(handler);
             this.setLexicalHandler(handler);
        } catch (Exception e) {
-            final String message = "Cannot set TextSerializer outputstream"; 
+            final String message = "Cannot set TextSerializer outputstream";
             throw new CascadingIOException(message, e);
         }
     }
 
     public void startElement(String uri, String loc, String raw, Attributes a)
-            throws SAXException {
+    throws SAXException {
         this.hasRootElement = true;
         super.startElement(uri, loc, raw, a);
     }
 
     public void characters(char c[], int start, int len)
-            throws SAXException {
+    throws SAXException {
         if (!this.hasRootElement) {
             this.hasRootElement = this.hadNoRootElement = true;
             getLogger().warn("Encountered text before root element. Creating <text> wrapper element.");
-            super.startElement("", "text", "text", new AttributesImpl());
+            super.startElement("", "text", "text", XMLUtils.EMPTY_ATTRIBUTES);
         }
         super.characters(c, start, len);
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/sitemap/ContentAggregator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/sitemap/ContentAggregator.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/sitemap/ContentAggregator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/sitemap/ContentAggregator.java Tue Apr 26 09:07:03 2005
@@ -27,6 +27,7 @@
 import org.apache.cocoon.generation.Generator;
 import org.apache.cocoon.xml.ContentHandlerWrapper;
 import org.apache.cocoon.xml.XMLConsumer;
+import org.apache.cocoon.xml.XMLUtils;
 
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.excalibur.source.Source;
@@ -35,7 +36,6 @@
 import org.apache.excalibur.source.impl.validity.AggregatedValidity;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
 
 import java.io.IOException;
 import java.io.Serializable;
@@ -49,11 +49,11 @@
  *
  * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
  */
-public class ContentAggregator
-        extends ContentHandlerWrapper
-        implements Generator, CacheableProcessingComponent, Serviceable {
+public class ContentAggregator extends ContentHandlerWrapper
+                               implements Generator, CacheableProcessingComponent,
+                                          Serviceable {
 
     /** The root element of the aggregated content */
     protected Element rootElement;
@@ -61,9 +61,6 @@
     /** The aggregated parts */
     protected ArrayList parts = new ArrayList();
 
-    /** Empty attributes */
-    private static final Attributes EMPTY_ATTRS = new AttributesImpl();
-
     /** Indicates the position in the stack of the root element of the aggregated content */
     private int rootElementIndex;
 
@@ -310,7 +307,7 @@
         if (!element.namespace.equals("")) {
             this.contentHandler.startPrefixMapping(element.prefix, element.namespace);
         }
-        this.contentHandler.startElement(element.namespace, element.name, qname, EMPTY_ATTRS);
+        this.contentHandler.startElement(element.namespace, element.name, qname, XMLUtils.EMPTY_ATTRIBUTES);
     }
 
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java Tue Apr 26 09:07:03 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * 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.
@@ -101,12 +101,20 @@
  * is invoked.
  *
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
 */
 public abstract class AbstractSAXTransformer
         extends AbstractTransformer
         implements Serviceable, Configurable, Recyclable {
 
+
+    /**
+     * Empty attributes (for performance). This can be used
+     * do create own attributes, but make sure to clean them
+     * afterwords.
+     */
+    protected static final Attributes EMPTY_ATTRIBUTES = XMLUtils.EMPTY_ATTRIBUTES;
+
     /**
      * The trax <code>TransformerFactory</code> used by this transformer.
      */
@@ -213,13 +221,6 @@
     private boolean isInitialized;
 
     /**
-     * Empty attributes (for performance). This can be used
-     * do create own attributes, but make sure to clean them
-     * afterwords.
-     */
-    protected AttributesImpl emptyAttributes = new AttributesImpl();
-
-    /**
      * The namespaces and their prefixes
      */
     private final List namespaces = new ArrayList(5);
@@ -626,7 +627,7 @@
         DOMBuilder builder = new DOMBuilder(this.tfactory);
         addRecorder(builder);
         builder.startDocument();
-        builder.startElement("", "cocoon", "cocoon", new AttributesImpl());
+        builder.startElement("", "cocoon", "cocoon", EMPTY_ATTRIBUTES);
         sendStartPrefixMapping();
     }
 
@@ -755,7 +756,7 @@
      */
     public void sendStartElementEvent(String localname)
     throws SAXException {
-        startElement("", localname, localname, emptyAttributes);
+        startElement("", localname, localname, EMPTY_ATTRIBUTES);
     }
 
     /**
@@ -769,7 +770,7 @@
     public void sendStartElementEventNS(String localname)
     throws SAXException {
         startElement(this.namespaceURI,
-                     localname, this.ourPrefix + ':' + localname, emptyAttributes);
+                     localname, this.ourPrefix + ':' + localname, EMPTY_ATTRIBUTES);
     }
 
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java Tue Apr 26 09:07:03 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * 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.
@@ -123,11 +123,10 @@
  *
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * @author <a href="mailto:acoliver@apache.org">Andrew C. Oliver</a>
- * @version CVS $Id$
+ * @version $Id$
  */
-public class CIncludeTransformer
-extends AbstractSAXTransformer
-implements Disposable, CacheableProcessingComponent {
+public class CIncludeTransformer extends AbstractSAXTransformer
+                                 implements Disposable, CacheableProcessingComponent {
 
     public static final String CINCLUDE_NAMESPACE_URI = "http://apache.org/cocoon/include/1.0";
     public static final String CINCLUDE_INCLUDE_ELEMENT = "include";
@@ -506,14 +505,13 @@
 
         // usual no caching stuff
         if (!"".equals(element)) {
-            AttributesImpl attrs = new AttributesImpl();
             if (!ns.equals("")) {
                 super.startPrefixMapping(prefix, ns);
             }
             super.startElement(ns,
                                element,
                                (!ns.equals("") && !prefix.equals("") ? prefix+":"+element : element),
-                               attrs);
+                               XMLUtils.EMPTY_ATTRIBUTES);
         }
 
         Source source = null;

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * 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.
@@ -15,25 +15,10 @@
  */
 package org.apache.cocoon.xml.dom;
 
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.TransformerException;
-
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.xml.IncludeXMLConsumer;
 import org.apache.cocoon.xml.XMLUtils;
+
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.excalibur.source.SourceParameters;
@@ -52,14 +37,28 @@
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.TransformerException;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
 
 /**
  *  This class is a utility class for miscellaneous DOM functions, like
  *  getting and setting values of nodes.
  *
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
 */
 public final class DOMUtil {
 
@@ -271,7 +270,7 @@
 
             DOMBuilder builder = new DOMBuilder();
             builder.startDocument();
-            builder.startElement("", "root", "root", new AttributesImpl());
+            builder.startElement("", "root", "root", XMLUtils.EMPTY_ATTRIBUTES);
 
             IncludeXMLConsumer filter = new IncludeXMLConsumer(builder, builder);
             parser.parse(input, filter);
@@ -497,8 +496,8 @@
     /**
      * Implementation for <code>java.util.Map</code> :
      * For each entry an element is created with the childs key and value
-     * Outputs the value and the key by calling {@link #valueOf(Node, Object)} 
-     * on each value and key of the Map. 
+     * Outputs the value and the key by calling {@link #valueOf(Node, Object)}
+     * on each value and key of the Map.
      *
      * @param parent The node getting the value
      * @param v      the Map
@@ -509,7 +508,7 @@
             parent.appendChild(mapNode);
             for (Iterator iter = v.entrySet().iterator(); iter.hasNext(); ) {
                 Map.Entry me = (Map.Entry)iter.next();
-                
+
                 Node entryNode = mapNode.getOwnerDocument().createElementNS(null, "entry");
                 mapNode.appendChild(entryNode);
 
@@ -592,12 +591,12 @@
      *
      * @throws TransformerException
      */
-    public static Node getSingleNode(Node contextNode, String str, 
-                                     XPathProcessor processor) 
+    public static Node getSingleNode(Node contextNode, String str,
+                                     XPathProcessor processor)
     throws TransformerException {
         String[] pathComponents = buildPathArray(str);
         if (pathComponents == null) {
-            return processor.selectSingleNode(contextNode, str); 
+            return processor.selectSingleNode(contextNode, str);
         } else {
             return getFirstNodeFromPath(contextNode, pathComponents, false);
         }
@@ -1096,7 +1095,7 @@
      * @throws ProcessingException If the node is not found.
      */
     public static boolean getValueAsBooleanOf(Node root, String path,
-                                              XPathProcessor processor) 
+                                              XPathProcessor processor)
     throws ProcessingException {
         String value = getValueOf(root, path, processor);
         if (value == null) {
@@ -1147,7 +1146,7 @@
         if (value != null) {
             return Boolean.valueOf(value).booleanValue();
         }
-        return defaultValue;        
+        return defaultValue;
     }
 
     /**
@@ -1202,7 +1201,7 @@
         if (pathComponents != null) {
             return getNodeListFromPath(contextNode, pathComponents);
         }
-       return processor.selectNodeList(contextNode, str); 
+       return processor.selectNodeList(contextNode, str);
     }
 
     /**
@@ -1444,7 +1443,7 @@
     /**
      * Converts a org.w3c.dom.Node to a String. Uses {@link javax.xml.transform.Transformer}
      * to convert from a Node to a String.
-     * 
+     *
      * @param node a <code>org.w3c.dom.Node</code> value
      * @return String representation of the document
      * @deprecated Use {@link XMLUtils#serializeNodeToXML(Node)} instead.

Modified: cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java Tue Apr 26 09:07:03 2005
@@ -20,10 +20,9 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.generation.AbstractGenerator;
+import org.apache.cocoon.xml.XMLUtils;
 
-import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
 
 import java.io.IOException;
 import java.util.Map;
@@ -59,11 +58,10 @@
      */
     public void generate()
     throws ProcessingException , SAXException, IOException {
-        Attributes noAttrs = new AttributesImpl();
         this.contentHandler.startDocument();
-        this.contentHandler.startElement("", "html", "html", noAttrs);
-        this.contentHandler.startElement("", "body", "body", noAttrs);
-        this.contentHandler.startElement("", "p", "p", noAttrs);
+        this.contentHandler.startElement("", "html", "html", XMLUtils.EMPTY_ATTRIBUTES);
+        this.contentHandler.startElement("", "body", "body", XMLUtils.EMPTY_ATTRIBUTES);
+        this.contentHandler.startElement("", "p", "p", XMLUtils.EMPTY_ATTRIBUTES);
 
         String text = ExceptionAction.exception(this.exception, this.code);
         this.contentHandler.characters(text.toCharArray(), 0, text.length());

Modified: cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/parentcm/Generator.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/parentcm/Generator.java?rev=164808&r1=164807&r2=164808&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/parentcm/Generator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/parentcm/Generator.java Tue Apr 26 09:07:03 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * 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.
@@ -19,6 +19,7 @@
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.xml.XMLUtils;
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.generation.ServiceableGenerator;
 import org.xml.sax.SAXException;
@@ -35,7 +36,7 @@
  * <code>Time</code> component.
  *
  * @author <a href="mailto:leo.sutic@inspireinfrastructure.com">Leo Sutic</a>
- * @version CVS $Id$
+ * @version $Id$
  */
 public class Generator extends ServiceableGenerator implements Poolable {
 
@@ -64,13 +65,12 @@
     /**
      * Generate XML data.
      */
-    public void generate() throws SAXException, ProcessingException {
-        AttributesImpl emptyAttributes = new AttributesImpl();
+    public void generate()
+    throws SAXException, ProcessingException {
         contentHandler.startDocument();
-        contentHandler.startElement("", "time", "time", emptyAttributes);
+        contentHandler.startElement("", "time", "time", XMLUtils.EMPTY_ATTRIBUTES);
 
         char[] text = this.time.toString().toCharArray();
-
         contentHandler.characters(text, 0, text.length);
 
         contentHandler.endElement("", "time", "time");