[ https://issues.apache.org/jira/browse/COCOON3-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144967#comment-13144967 ]
Andre Juffer commented on COCOON3-77: ------------------------------------- # This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and \n newlines. --- Locally New +++ Locally New @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.components.serializers.encoding; + +/** + * Encodes nothing. All characters are returned as they are. + * @author André Juffer, Triacle Biocomputing + */ +public class TextEncoder extends XMLEncoder { + + private final static String ENCODING_NAME = "X-W3C-TEXT"; + + public TextEncoder() + { + super(ENCODING_NAME); + } + + protected TextEncoder(String encodingName) + { + super(encodingName); + } + + /** + * @return true (always) + */ + @Override + public boolean compile(char ch) + { + return true; + } + + /** + * @return Original character in a character array. + */ + @Override + public char[] encode(char ch) + { + char chs[] = { ch }; + return chs; + } + +} > Text and JSON serializers > ------------------------- > > Key: COCOON3-77 > URL: https://issues.apache.org/jira/browse/COCOON3-77 > Project: Cocoon 3 > Issue Type: Improvement > Components: cocoon-optional > Affects Versions: 3.0.0-alpha-3 > Reporter: Andre Juffer > Priority: Minor > Attachments: EncodingJsonSerializer.java, > EncodingTextSerializer.java, JsonSerializer.java, TextEncoder.java, > TextSerializer.java, pom.xml, tribc-cocoon-3.xml > > > Serveral classes have been created for serializing text and JSON in the > sitemap. The JsonSerializer also checks whether the JSON text actually is > valid. The organization of the classes follows the encoding serializers (such > as the EncodingHTMLSerializer). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira