Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 package org.apache.xmlrpc.serializer;
00020
00021 import java.io.OutputStream;
00022 import java.io.StringWriter;
00023
00024 import org.apache.ws.commons.serialize.CharSetXMLWriter;
00025 import org.apache.xmlrpc.XmlRpcException;
00026 import org.apache.xmlrpc.common.XmlRpcStreamConfig;
00027 import org.xml.sax.ContentHandler;
00028 import org.xml.sax.helpers.AttributesImpl;
00029
00030
00038 public class DefaultXMLWriterFactory implements XmlWriterFactory {
00039 private final XmlWriterFactory factory;
00040
00043 public DefaultXMLWriterFactory() {
00044 XmlWriterFactory xwf;
00045 try {
00046 CharSetXMLWriter csw = new CharSetXMLWriter();
00047 StringWriter sw = new StringWriter();
00048 csw.setWriter(sw);
00049 csw.startDocument();
00050 csw.startElement("", "test", "test", new AttributesImpl());
00051 csw.endElement("", "test", "test");
00052 csw.endDocument();
00053 xwf = new CharSetXmlWriterFactory();
00054 } catch (Throwable t) {
00055 xwf = new BaseXmlWriterFactory();
00056 }
00057 factory = xwf;
00058 }
00059
00060 public ContentHandler getXmlWriter(XmlRpcStreamConfig pConfig,
00061 OutputStream pStream) throws XmlRpcException {
00062 return factory.getXmlWriter(pConfig, pStream);
00063 }
00064 }