public void write(Writer writer) throws Exception {
  writer.write(toString());
  writer.flush();
}

public void write ( Writer writer ) throws Exception { writer . write ( toString ( ) ) ; writer . flush ( ) ; }
writes the current dom document into the given writer .
