1 26 27 package net.sourceforge.groboutils.codecoverage.v2.report; 28 29 import java.io.IOException ; 30 import java.io.Writer ; 31 32 import org.apache.tools.ant.util.DOMElementWriter; 33 import org.w3c.dom.Element ; 34 35 36 43 public class OutputXml 44 { 45 public static final String DEFAULT_ENCODING = "UTF-8"; 46 47 58 public void write( Element rootEl, Writer out, String encoding ) 59 throws IOException 60 { 61 if (out == null) 62 { 63 throw new IllegalArgumentException ("no null args"); 64 } 65 if (encoding == null) 66 { 67 encoding = DEFAULT_ENCODING; 68 } 69 70 out.write("<?xml version=\"1.0\" encoding=\""+encoding+"\" ?>\n"); 71 (new DOMElementWriter()).write(rootEl, out, 0, " "); 72 out.flush(); 73 } 74 } 75 76 | Popular Tags |