1 55 56 package org.jboss.axis.encoding.ser; 57 58 import org.jboss.axis.attachments.SourceDataSource; 59 import org.jboss.axis.encoding.SerializationContext; 60 import org.jboss.axis.utils.Messages; 61 import org.jboss.logging.Logger; 62 import org.xml.sax.Attributes ; 63 64 import javax.activation.DataHandler ; 65 import javax.xml.namespace.QName ; 66 import javax.xml.transform.stream.StreamSource ; 67 import java.io.IOException ; 68 69 74 public class SourceDataHandlerSerializer extends JAFDataHandlerSerializer 75 { 76 77 private static Logger log = Logger.getLogger(SourceDataHandlerSerializer.class.getName()); 78 79 82 public void serialize(QName name, Attributes attributes, 83 Object value, SerializationContext context) 84 throws IOException 85 { 86 if (value != null) 87 { 88 if (!(value instanceof StreamSource )) 89 { 90 throw new IOException (Messages.getMessage("badSource", 91 value.getClass().getName())); 92 } 93 DataHandler dh = new DataHandler (new SourceDataSource("source", 94 "text/xml", (StreamSource )value)); 95 super.serialize(name, attributes, dh, context); 96 } 97 } } | Popular Tags |