question: public void write ( OutputStream stream ) throws Exception { String xml ; xml = toString ( ) ; stream . write ( xml . getBytes ( ) , 0 , xml . length ( ) ) ; stream . flush ( ) ; }
target:  writes the current DOM document into the given stream.