Debian Codegraph @

test/encoding/DataSer.java

raw
1 package test.encoding;
2
3 import org.apache.axis.Constants;
4 import org.apache.axis.encoding.SerializationContext;
5 import org.apache.axis.encoding.Serializer;
6 import org.apache.axis.wsdl.fromJava.Types;
7 import org.w3c.dom.Element;
8 import org.xml.sax.Attributes;
9
10 import javax.xml.namespace.QName;
11 import java.io.IOException;
12
13 public class DataSer implements Serializer
14 {
15 public static final String STRINGMEMBER = "stringMember";
16 public static final String FLOATMEMBER = "floatMember";
17
18 /** SERIALIZER STUFF
19 */
20 /**
21 * Serialize an element named name, with the indicated attributes
22 * and value.
23 * @param name is the element name
24 * @param attributes are the attributes...serialize is free to add more.
25 * @param value is the value
26 * @param context is the SerializationContext
27 */
28 public void serialize(QName name, Attributes attributes,
29 Object value, SerializationContext context)
30 throws IOException
31 {
32 if (!(value instanceof Data))
33 throw new IOException("Can't serialize a " + value.getClass().getName() + " with a DataSerializer.");
34 Data data = (Data)value;
35
36 context.startElement(name, attributes);
37 context.serialize(new QName("", STRINGMEMBER), null, data.stringMember);
38 context.serialize(new QName("", FLOATMEMBER), null, data.floatMember);
39 context.endElement();
40 }
41 public String getMechanismType() { return Constants.AXIS_SAX; }
42
43 public Element writeSchema(Class javaType, Types types) throws Exception {
44 return null;
45 }
46 }