1 4 5 9 10 11 65 66 package org.openlaszlo.remote.soap.encoding; 67 68 import javax.xml.namespace.QName ; 69 import java.io.IOException ; 70 import org.apache.axis.encoding.SerializationContext; 71 import org.apache.axis.encoding.Serializer; 72 import org.apache.axis.wsdl.fromJava.Types; 73 import org.w3c.dom.Element ; 74 import org.w3c.dom.Node ; 75 import org.w3c.dom.NodeList ; 76 import org.xml.sax.Attributes ; 77 import org.apache.log4j.Logger; 78 import org.openlaszlo.remote.soap.ObjectWrapper; 79 80 public class LZObjectSerializer implements Serializer { 81 82 private static Logger mLogger = Logger.getLogger(LZObjectSerializer.class); 83 84 public static String MECHANISM_TYPE = "LZObjectMechanism"; 85 86 public String getMechanismType() { return MECHANISM_TYPE; } 87 88 91 public void serialize(QName name, Attributes attributes, 92 Object value, SerializationContext context) 93 throws IOException 94 { 95 mLogger.debug("serialize(" + name + "," + attributes + 96 "," + value + "," + context + ")"); 97 98 context.startElement(name, attributes); 99 NodeList list = ((ObjectWrapper)value).getElement().getChildNodes(); 100 for (int i=0; i < list.getLength(); i++) { 101 Node node = (Node )list.item(i); 102 if ( node.getNodeType() == Node.ELEMENT_NODE) { 103 context.writeDOMElement((Element )node); 104 } 105 } 106 context.endElement(); 107 } 108 109 110 113 public Element writeSchema(Class javaType, Types types) throws Exception { 114 throw new Exception ("unimplemented"); 115 } 116 } 117 | Popular Tags |