Implemeted action for uploading Wikipedia articles (thanks to D.Wunsch)
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / util / xml / XMLHelper.java
index 9fdeeef..2e78469 100644 (file)
@@ -10,8 +10,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.xalan.serialize.DOMSerializer;
-import org.apache.xalan.serialize.SerializerToXML;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
@@ -25,30 +23,6 @@ public class XMLHelper {
     
     private XMLHelper() {}
     
-    public static DOMSerializer createDOMSerializer(Writer writer) 
-        throws IOException {
-//      XMLSerializer serializer = new XMLSerializer(writer, createOutputFormat());
-//     return serializer.asDOMSerializer();
-       SerializerToXML serializer = new SerializerToXML();
-        serializer.setWriter(writer);
-        return serializer.asDOMSerializer();
-    }
-
-    public static DOMSerializer createDOMSerializer(OutputStream stream) 
-        throws IOException {
-//      XMLSerializer serializer = new XMLSerializer(stream, createOutputFormat());
-//      return serializer.asDOMSerializer();
-        SerializerToXML serializer = new SerializerToXML();
-        serializer.setOutputStream(stream);
-        return serializer.asDOMSerializer();
-    }
-//    private static OutputFormat createOutputFormat() {
-//        OutputFormat format = new OutputFormat();
-//        format.setIndenting(true);
-//        format.setLineWidth(80);
-//        return format;
-//    }
-    
     public static Document createEmptyDocument() throws ParserConfigurationException {
         DocumentBuilder builder = createDocumentBuilder();
         return builder.newDocument();
@@ -68,11 +42,11 @@ public class XMLHelper {
     
     public static void write(Writer writer, Document document) 
         throws IOException {
-        createDOMSerializer(writer).serialize(document);
+        writer.write(XMLRenderer.render(document));
     }
 
     public static void write(OutputStream stream, Document document) 
         throws IOException {
-        createDOMSerializer(stream).serialize(document);
+        stream.write(XMLRenderer.render(document).getBytes());
     }
 }