Index: DOMUtilities.java =================================================================== --- DOMUtilities.java (revision 498532) +++ DOMUtilities.java (working copy) @@ -22,6 +22,12 @@ import java.io.Writer; import org.apache.batik.xml.XMLUtilities; +import org.apache.batik.transcoder.Transcoder; +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.TranscodingHints; +import org.apache.batik.transcoder.svg2svg.SVGTranscoder; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; @@ -54,6 +60,17 @@ writeNode(n, w); } } + + /** + * Writes the given document (in pretty printer format) using the given writer. + */ + public static void writeDocument(Document doc, Writer w, TranscodingHints hints) throws IOException, TranscoderException { + Transcoder transcoder = new SVGTranscoder(); + TranscoderInput in = new TranscoderInput(doc); + TranscoderOutput out = new TranscoderOutput(w); + transcoder.setTranscodingHints(hints); + transcoder.transcode(in, out); + } /** * Writes a node using the given writer.