diff --git a/src/main/org/apache/tools/ant/util/DOMElementWriter.java b/src/main/org/apache/tools/ant/util/DOMElementWriter.java index a7b6d6718..4e0ef2d9d 100644 --- a/src/main/org/apache/tools/ant/util/DOMElementWriter.java +++ b/src/main/org/apache/tools/ant/util/DOMElementWriter.java @@ -157,13 +157,21 @@ public class DOMElementWriter { */ public void write(Element root, OutputStream out) throws IOException { Writer wri = new OutputStreamWriter(out, "UTF8"); - if(xmlDeclaration) { - wri.write("\n"); - } + writeXMLDeclaration(wri); write(root, wri, 0, " "); wri.flush(); } + /** + * Writes the XML declaration. + * @since Ant 1.7.0 + */ + public void writeXMLDeclaration(Writer wri) throws IOException { + if (xmlDeclaration) { + wri.write("\n"); + } + } + /** * Writes a DOM tree to a stream. *