Improved support for comment folding
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / util / xml / XMLHelper.java
index bf16296..2e78469 100644 (file)
@@ -10,9 +10,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.xml.serialize.DOMSerializer;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
@@ -26,24 +23,6 @@ public class XMLHelper {
     
     private XMLHelper() {}
     
-    public static DOMSerializer createDOMSerializer(Writer writer) 
-        throws IOException {
-        XMLSerializer serializer = new XMLSerializer(writer, createOutputFormat());
-        return serializer.asDOMSerializer();
-    }
-
-    public static DOMSerializer createDOMSerializer(OutputStream stream) 
-        throws IOException {
-        XMLSerializer serializer = new XMLSerializer(stream, createOutputFormat());
-        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();
@@ -63,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());
     }
 }