/** * Transcodes the specified input in the specified output. * @param input the input to transcode * @param output the ouput where to transcode * @exception TranscoderException if an error occured while transcoding */ public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { Reader r = input.getReader(); Writer w = output.getWriter(); if (r == null) { Document d = input.getDocument(); if (d == null) { throw new Error("Reader or Document expected"); } StringWriter sw = new StringWriter( 1024 ); try { DOMUtilities.writeDocument(d, sw); } catch ( IOException ioEx ) { throw new Error("IO:" + ioEx.getMessage() ); } r = new StringReader(sw.toString()); } if (w == null) { throw new Error("Writer expected"); } prettyPrint(r, w); }
/** * Transcodes the specified input in the specified output. * @param input the input to transcode * @param output the ouput where to transcode * @exception TranscoderException if an error occured while transcoding */ public void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException { Reader r = input.getReader(); Writer w = output.getWriter(); if (r == null) { Document d = input.getDocument(); if (d == null) { throw new RuntimeException("Reader or Document expected"); } StringWriter sw = new StringWriter( 1024 ); try { DOMUtilities.writeDocument(d, sw); } catch ( IOException ioEx ) { throw new RuntimeException("IO:" + ioEx.getMessage() ); } r = new StringReader(sw.toString()); } if (w == null) { throw new RuntimeException("Writer expected"); } prettyPrint(r, w); }
if (input.getDocument() != null) { document = input.getDocument(); } else { String parserClassname =
if (input.getDocument() != null) { document = input.getDocument(); } else { String parserClassname =