Browse Source

make XML decl accessible

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@432871 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 19 years ago
parent
commit
9b30afed0e
1 changed files with 11 additions and 3 deletions
  1. +11
    -3
      src/main/org/apache/tools/ant/util/DOMElementWriter.java

+ 11
- 3
src/main/org/apache/tools/ant/util/DOMElementWriter.java View File

@@ -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("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\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("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
}
}

/**
* Writes a DOM tree to a stream.
*


Loading…
Cancel
Save