/** Writes the contents of the DOMOutput into the specified writer. */ public void save(Writer out) throws IOException { if (doctype != null) { out.write("<!DOCTYPE "); out.write(doctype); out.write(">\n"); } XMLWriter writer = new XMLWriter(out); writer.write((XMLElement) document.getChildren().get(0)); }
/** Prints the contents of the DOMOutput into the specified print writer. */ public void print(PrintWriter out) { XMLWriter writer = new XMLWriter(out); try { // writer.write(document); writer.write((XMLElement) document.getChildren().get(0), true); } catch (IOException e) { InternalError error = new InternalError(); error.initCause(e); throw error; } // ((XMLElement) document.getChildren().get(0)).print(out); }
public static void main(String args[]) throws Exception { XMLElement elt = new XMLElement("FOO"); elt.setAttribute(null, "good"); XMLWriter writer = new XMLWriter(System.out); writer.write(elt); }