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.apache.xalan.serialize.DOMSerializer;
+import org.apache.xalan.serialize.SerializerToXML;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
public static DOMSerializer createDOMSerializer(Writer writer)
throws IOException {
- XMLSerializer serializer = new XMLSerializer(writer, createOutputFormat());
+// 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());
+// 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;
- }
+// 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();