@ Override public void startDocument ( ) throws SAXException { try { switch ( doctype ) { case NO_DOCTYPE : return ; case DOCTYPE_HTML5 : writer . write ( "<!DOCTYPE html>\n" ) ; return ; case DOCTYPE_HTML401_STRICT : writer . write ( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n" ) ; return ; case DOCTYPE_HTML401_TRANSITIONAL : writer . write ( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" ) ; return ; } } catch ( IOException ioe ) { throw ( SAXException ) new SAXException ( ioe ) . initCause ( ioe ) ; } }
Must be called first .