TypeSerializerImpl.java
Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one
00003  * or more contributor license agreements.  See the NOTICE file
00004  * distributed with this work for additional information
00005  * regarding copyright ownership.  The ASF licenses this file
00006  * to you under the Apache License, Version 2.0 (the
00007  * "License"); you may not use this file except in compliance
00008  * with the License.  You may obtain a copy of the License at
00009  *
00010  *   http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing,
00013  * software distributed under the License is distributed on an
00014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00015  * KIND, either express or implied.  See the License for the
00016  * specific language governing permissions and limitations
00017  * under the License.    
00018  */
00019 package org.apache.xmlrpc.serializer;
00020 
00021 import org.xml.sax.Attributes;
00022 import org.xml.sax.ContentHandler;
00023 import org.xml.sax.SAXException;
00024 import org.xml.sax.helpers.AttributesImpl;
00025 
00026 
00029 public abstract class TypeSerializerImpl implements TypeSerializer {
00030         protected static final Attributes ZERO_ATTRIBUTES = new AttributesImpl();
00033         public static final String VALUE_TAG = "value";
00034 
00035         protected void write(ContentHandler pHandler, String pTagName, String pValue) throws SAXException {
00036                 write(pHandler, pTagName, pValue.toCharArray());
00037         }
00038 
00039         protected void write(ContentHandler pHandler, String pTagName, char[] pValue) throws SAXException {
00040                 pHandler.startElement("", TypeSerializerImpl.VALUE_TAG, TypeSerializerImpl.VALUE_TAG, ZERO_ATTRIBUTES);
00041                 if (pTagName != null) {
00042                         pHandler.startElement("", pTagName, pTagName, ZERO_ATTRIBUTES);
00043                 }
00044                 pHandler.characters(pValue, 0, pValue.length);
00045                 if (pTagName != null) {
00046                         pHandler.endElement("", pTagName, pTagName);
00047                 }
00048                 pHandler.endElement("", TypeSerializerImpl.VALUE_TAG, TypeSerializerImpl.VALUE_TAG);
00049         }
00050 
00051         protected void write(ContentHandler pHandler, String pLocalName, String pQName,
00052                                                  String pValue) throws SAXException {
00053                 pHandler.startElement("", TypeSerializerImpl.VALUE_TAG, TypeSerializerImpl.VALUE_TAG, ZERO_ATTRIBUTES);
00054                 pHandler.startElement(XmlRpcWriter.EXTENSIONS_URI, pLocalName, pQName, ZERO_ATTRIBUTES);
00055                 char[] value = pValue.toCharArray();
00056                 pHandler.characters(value, 0, value.length);
00057                 pHandler.endElement(XmlRpcWriter.EXTENSIONS_URI, pLocalName, pQName);
00058                 pHandler.endElement("", TypeSerializerImpl.VALUE_TAG, TypeSerializerImpl.VALUE_TAG);
00059         }
00060 }


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:49