/** * @param writer not null * @param lineIndenter could be null, but the normal way is some spaces. * @param lineSeparator could be null, but the normal way is valid line separator ("\n" on UNIX). * @param encoding could be null or invalid. * @param doctype could be null. */ public PrettyPrintXMLWriter( PrintWriter writer, String lineIndenter, String lineSeparator, String encoding, String doctype ) { setWriter( writer ); setLineIndenter( lineIndenter ); setLineSeparator( lineSeparator ); setEncoding( encoding ); setDocType( doctype ); if ( doctype != null || encoding != null ) { writeDocumentHeaders(); } }