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/22 02:20:37 UTC
svn commit: r164152 -
/cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
Author: vgritsenko
Date: Thu Apr 21 17:20:36 2005
New Revision: 164152
URL: http://svn.apache.org/viewcvs?rev=164152&view=rev
Log:
bit of cleanup
Modified:
cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
Modified: cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java?rev=164152&r1=164151&r2=164152&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java Thu Apr 21 17:20:36 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.
@@ -53,45 +53,37 @@
* (Apache Software Foundation)
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:sylvain.wallez@anyware-tech.com">Sylvain Wallez</a>
- * @version CVS $Id$
+ * @version $Id$
*/
public abstract class AbstractTextSerializer extends AbstractSerializer
implements Configurable, CacheableProcessingComponent {
/**
- * The trax <code>TransformerFactory</code> used by this serializer.
- */
- private SAXTransformerFactory tfactory = null;
-
- /**
- * The <code>Properties</code> used by this serializer.
- */
- protected Properties format = new Properties();
-
- /**
- * The default output buffer size.
+ * Cache for avoiding unnecessary checks of namespaces abilities.
+ * It associates a Boolean to the transformer class name.
*/
- //private static final int DEFAULT_BUFFER_SIZE = 8192;
+ private static final Map needsNamespaceCache = new HashMap();
/**
- * The output buffer size to use.
+ * The trax <code>TransformerFactory</code> used by this serializer.
*/
- //private int outputBufferSize = DEFAULT_BUFFER_SIZE;
+ private SAXTransformerFactory tfactory;
/**
- * Cache for avoiding unnecessary checks of namespaces abilities.
- * It associates a Boolean to the transformer class name.
+ * The <code>Properties</code> used by this serializer.
*/
- private static Map needsNamespaceCache = new HashMap();
+ protected final Properties format = new Properties();
/**
* The pipe that adds namespaces as xmlns attributes.
*/
private NamespaceAsAttributes namespacePipe;
- /** The caching key */
+ /**
+ * The caching key
+ */
private String cachingKey = "1";
-
+
/**
* Interpose namespace pipe if needed.
@@ -191,7 +183,7 @@
String version = conf.getChild("version").getValue(null);
final StringBuffer buffer = new StringBuffer();
-
+
if (cdataSectionElements != null) {
format.put(OutputKeys.CDATA_SECTION_ELEMENTS, cdataSectionElements);
buffer.append(";cdata-section-elements=").append(cdataSectionElements);
@@ -232,14 +224,13 @@
format.put(OutputKeys.VERSION, version);
buffer.append(";version=").append(version);
}
-
+
if ( buffer.length() > 0 ) {
this.cachingKey = buffer.toString();
}
- Configuration tFactoryConf = conf.getChild("transformer-factory", false);
- if (tFactoryConf != null) {
- String tFactoryClass = tFactoryConf.getValue();
+ String tFactoryClass = conf.getChild("transformer-factory").getValue(null);
+ if (tFactoryClass != null) {
try {
this.tfactory = (SAXTransformerFactory) ClassUtils.newInstance(tFactoryClass);
if (getLogger().isDebugEnabled()) {
@@ -252,7 +243,6 @@
// Standard TrAX behaviour
this.tfactory = (SAXTransformerFactory) TransformerFactory.newInstance();
}
-
tfactory.setErrorListener(new TraxErrorHandler(getLogger()));
// Check if we need namespace as attributes.