|
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 |
5
| public void serialize(QName pvQName, Attributes pvAttributes, Object pvValue, SerializationContext pvContext) throws IOException {
|
|
19 |
5
| pvContext.startElement(pvQName, pvAttributes);
|
|
20 |
5
| String lvValue = getValueAsString(pvValue, pvContext);
|
|
21 |
5
| if (lvValue != null) {
|
|
22 |
4
| pvContext.writeString(lvValue);
|
|
23 |
| } |
|
24 |
5
| pvContext.endElement();
|
|
25 |
| } |
|
26 |
| |
|
27 |
1
| public Element writeSchema(Class pvClass, Types pvTypes) throws Exception {
|
|
28 |
1
| return null;
|
|
29 |
| } |
|
30 |
| |
|
31 |
1
| public String getMechanismType() {
|
|
32 |
1
| return Constants.AXIS_SAX;
|
|
33 |
| } |
|
34 |
| |
|
35 |
6
| public String getValueAsString(Object pvValue, SerializationContext pvContext) {
|
|
36 |
6
| String lvValue = (pvValue == null ? null : pvValue.toString());
|
|
37 |
6
| return lvValue;
|
|
38 |
| } |
|
39 |
| |
|
40 |
| } |