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:44:02 UTC
svn commit: r164817 -
/cocoon/blocks/unsupported/chaperon/trunk/java/org/apache/cocoon/transformation/PatternTransformer.java
Author: vgritsenko
Date: Tue Apr 26 09:44:01 2005
New Revision: 164817
URL: http://svn.apache.org/viewcvs?rev=164817&view=rev
Log:
Use EMPTY_PROPERTIES
Modified:
cocoon/blocks/unsupported/chaperon/trunk/java/org/apache/cocoon/transformation/PatternTransformer.java
Modified: cocoon/blocks/unsupported/chaperon/trunk/java/org/apache/cocoon/transformation/PatternTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/chaperon/trunk/java/org/apache/cocoon/transformation/PatternTransformer.java?rev=164817&r1=164816&r2=164817&view=diff
==============================================================================
--- cocoon/blocks/unsupported/chaperon/trunk/java/org/apache/cocoon/transformation/PatternTransformer.java (original)
+++ cocoon/blocks/unsupported/chaperon/trunk/java/org/apache/cocoon/transformation/PatternTransformer.java Tue Apr 26 09:44:01 2005
@@ -1,19 +1,18 @@
/*
- * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.cocoon.transformation;
import net.sourceforge.chaperon.build.LexicalAutomatonBuilder;
@@ -35,6 +34,7 @@
import org.apache.avalon.framework.service.Serviceable;
import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.xml.XMLUtils;
import org.apache.cocoon.caching.CacheableProcessingComponent;
import org.apache.cocoon.components.source.SourceUtil;
import org.apache.cocoon.environment.SourceResolver;
@@ -57,7 +57,7 @@
/**
* This transfomer transforms text pattern of a XML file into lexemes by using a lexicon file.
- *
+ *
* <p>
* Input:
* </p>
@@ -66,7 +66,7 @@
* Text 123 bla
* </section>
* </pre>
- *
+ *
* <p>
* can be transformed into the following output:
* </p>
@@ -79,13 +79,12 @@
* </pre>
*
* @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
- * @version CVS $Id: PatternTransformer.java,v 1.9 2004/03/05 13:01:48 bdelacretaz Exp $
+ * @version $Id$
*/
-public class PatternTransformer extends AbstractTransformer implements LogEnabled, Serviceable,
- Recyclable, Disposable,
- Parameterizable,
- CacheableProcessingComponent
-{
+public class PatternTransformer extends AbstractTransformer
+ implements LogEnabled, Serviceable, Recyclable,
+ Disposable, Parameterizable, CacheableProcessingComponent {
+
/** Namespace for the SAX events. */
public static final String NS = "http://chaperon.sourceforge.net/schema/lexemes/2.0";
private String lexicon = null;
@@ -425,15 +424,13 @@
atts.addAttribute("", "text", "text", "CDATA", lexemetext);
contentHandler.startElement(NS, "lexeme", "lexeme", atts);
- if (this.groups)
- {
- for (int group = 0; group<groups.length; group++)
- {
- contentHandler.startElement(NS, "group", "group", new AttributesImpl());
- contentHandler.characters(groups[group].toCharArray(), 0, groups[group].length());
- contentHandler.endElement(NS, "group", "group");
+ if (this.groups) {
+ for (int group = 0; group<groups.length; group++) {
+ contentHandler.startElement(NS, "group", "group", XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.characters(groups[group].toCharArray(), 0, groups[group].length());
+ contentHandler.endElement(NS, "group", "group");
+ }
}
- }
contentHandler.endElement(NS, "lexeme", "lexeme");
contentHandler.endPrefixMapping("");