01: package net.sf.crispy.impl.jaxrpc.serializer;
02:
03: import java.io.IOException;
04:
05: import javax.xml.namespace.QName;
06:
07: import org.apache.axis.Constants;
08: import org.apache.axis.encoding.SerializationContext;
09: 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
14: org.apache.axis.encoding.Serializer { // extends SimpleSerializer {
15:
16: private static final long serialVersionUID = 7590914248036359963L;
17:
18: public void serialize(QName pvQName, Attributes pvAttributes,
19: Object pvValue, SerializationContext pvContext)
20: throws IOException {
21: pvContext.startElement(pvQName, pvAttributes);
22: String lvValue = getValueAsString(pvValue, pvContext);
23: if (lvValue != null) {
24: pvContext.writeString(lvValue);
25: }
26: pvContext.endElement();
27: }
28:
29: public Element writeSchema(Class pvClass, Types pvTypes)
30: throws Exception {
31: return null;
32: }
33:
34: public String getMechanismType() {
35: return Constants.AXIS_SAX;
36: }
37:
38: public String getValueAsString(Object pvValue,
39: SerializationContext pvContext) {
40: String lvValue = (pvValue == null ? null : pvValue.toString());
41: return lvValue;
42: }
43:
44: }
|