1 55 56 package org.jboss.axis.encoding.ser; 57 58 import org.jboss.axis.Constants; 59 import org.jboss.axis.encoding.SerializationContext; 60 import org.jboss.axis.encoding.Serializer; 61 import org.jboss.axis.utils.Messages; 62 import org.jboss.axis.wsdl.fromJava.Types; 63 import org.w3c.dom.Element ; 64 import org.xml.sax.Attributes ; 65 66 import javax.xml.namespace.QName ; 67 import java.io.IOException ; 68 69 75 76 public class ElementSerializer implements Serializer 77 { 78 81 public void serialize(QName name, Attributes attributes, 82 Object value, SerializationContext context) 83 throws IOException 84 { 85 if (!(value instanceof Element )) 86 throw new IOException (Messages.getMessage("cantSerialize01")); 87 88 Element el = (Element )value; 89 String localName = (el.getLocalName() != null ? el.getLocalName() : el.getNodeName()); 90 91 QName elementQName; 92 if (el.getNamespaceURI() != null) 93 elementQName = new QName (el.getNamespaceURI(), localName, el.getPrefix()); 94 else 95 elementQName = new QName (localName); 96 97 boolean wrappElement = (elementQName.equals(name) == false); 98 99 if (wrappElement) 100 context.startElement(name, attributes); 101 102 context.writeDOMElement(el); 103 104 if (wrappElement) 105 context.endElement(); 106 } 107 108 public String getMechanismType() 109 { 110 return Constants.AXIS_SAX; 111 } 112 113 124 public Element writeSchema(Class javaType, Types types) throws Exception 125 { 126 return null; 127 } 128 } 129 | Popular Tags |