1 package net.sf.crispy.impl.jaxrpc.serializer;
2
3 import java.io.IOException;
4
5 import javax.xml.namespace.QName;
6
7 import org.apache.axis.Constants;
8 import org.apache.axis.encoding.SerializationContext;
9 import org.apache.axis.wsdl.fromJava.Types;
10 import org.w3c.dom.Element;
11 import org.xml.sax.Attributes;
12
13 public class CharacterSerializer implements org.apache.axis.encoding.Serializer {
14
15 private static final long serialVersionUID = 7590914248036359963L;
16
17
18 public void serialize(QName pvQName, Attributes pvAttributes, Object pvValue, SerializationContext pvContext) throws IOException {
19 pvContext.startElement(pvQName, pvAttributes);
20 String lvValue = getValueAsString(pvValue, pvContext);
21 if (lvValue != null) {
22 pvContext.writeString(lvValue);
23 }
24 pvContext.endElement();
25 }
26
27 public Element writeSchema(Class pvClass, Types pvTypes) throws Exception {
28 return null;
29 }
30
31 public String getMechanismType() {
32 return Constants.AXIS_SAX;
33 }
34
35 public String getValueAsString(Object pvValue, SerializationContext pvContext) {
36 String lvValue = (pvValue == null ? null : pvValue.toString());
37 return lvValue;
38 }
39
40 }