1 8 9 package mx4j.tools.remote.soap.axis.ser; 10 11 import java.io.IOException ; 12 import javax.management.ObjectName ; 13 import javax.xml.namespace.QName ; 14 15 import org.apache.axis.encoding.SerializationContext; 16 import org.apache.axis.encoding.XMLType; 17 import org.apache.axis.wsdl.fromJava.Types; 18 import org.w3c.dom.Element ; 19 import org.xml.sax.Attributes ; 20 21 24 public class ObjectNameSer extends AxisSerializer 25 { 26 static final String TYPE = "ObjectName"; 27 static final String NAME = "canonicalName"; 28 private static final QName NAME_QNAME = new QName ("", NAME); 29 30 public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException 31 { 32 ObjectName objectName = (ObjectName )value; 33 context.startElement(name, attributes); 34 context.serialize(NAME_QNAME, null, objectName.getCanonicalName()); 35 context.endElement(); 36 } 37 38 public Element writeSchema(Class javaType, Types types) throws Exception 39 { 40 Element complexType = types.createElement(SCHEMA_COMPLEX_TYPE); 41 complexType.setAttribute("name", TYPE); 42 Element allElement = types.createElement(SCHEMA_ALL); 43 complexType.appendChild(allElement); 44 Element element = types.createElement(SCHEMA_ELEMENT); 45 element.setAttribute("name", NAME); 46 element.setAttribute("type", XMLType.XSD_STRING.getLocalPart()); 47 allElement.appendChild(element); 48 return complexType; 49 } 50 } 51 | Popular Tags |