protected void printDocType(Writer out,DocType docType) throws IOException {
  String publicID=docType.getPublicID();
  String systemID=docType.getSystemID();
  String internalSubset=docType.getInternalSubset();
  boolean hasPublic=false;
  out.write("<!DOCTYPE ");
  out.write(docType.getElementName());
  if (publicID != null) {
    out.write(" PUBLIC \"");
    out.write(publicID);
    out.write("\"");
    hasPublic=true;
  }
  if (systemID != null) {
    if (!hasPublic) {
      out.write(" SYSTEM");
    }
    out.write(" \"");
    out.write(systemID);
    out.write("\"");
  }
  if ((internalSubset != null) && (!internalSubset.equals(""))) {
    out.write(" [");
    out.write(lineSeparator);
    out.write(docType.getInternalSubset());
    out.write("]");
  }
  out.write(">");
}

protected void printDocType ( Writer out , DocType docType ) throws IOException { String publicID = docType . getPublicID ( ) ; String systemID = docType . getSystemID ( ) ; String internalSubset = docType . getInternalSubset ( ) ; boolean hasPublic = false ; out . write ( "<!DOCTYPE " ) ; out . write ( docType . getElementName ( ) ) ; if ( publicID != null ) { out . write ( " PUBLIC \"" ) ; out . write ( publicID ) ; out . write ( "\"" ) ; hasPublic = true ; } if ( systemID != null ) { if ( ! hasPublic ) { out . write ( " SYSTEM" ) ; } out . write ( " \"" ) ; out . write ( systemID ) ; out . write ( "\"" ) ; } if ( ( internalSubset != null ) && ( ! internalSubset . equals ( "" ) ) ) { out . write ( " [" ) ; out . write ( lineSeparator ) ; out . write ( docType . getInternalSubset ( ) ) ; out . write ( "]" ) ; } out . write ( ">" ) ; }
this handle printing the doctype declaration if one exists .
