protected void printDocType(final Writer out, final FormatStack fstack,
			final DocType docType) throws IOException {

		final String publicID = docType.getPublicID();
		final String systemID = docType.getSystemID();
		final String internalSubset = docType.getInternalSubset();
		boolean hasPublic = false;

		// Declaration is never indented.
		// write(out, fstack.getLevelIndent());

		write(out, "<!DOCTYPE ");
		write(out, docType.getElementName());
		if (publicID != null) {
			write(out, " PUBLIC \"");
			write(out, publicID);
			write(out, "\"");
			hasPublic = true;
		}
		if (systemID != null) {
			if (!hasPublic) {
				write(out, " SYSTEM");
			}
			write(out, " \"");
			write(out, systemID);
			write(out, "\"");
		}
		if ((internalSubset != null) && (!internalSubset.equals(""))) {
			write(out, " [");
			write(out, fstack.getLineSeparator());
			write(out, docType.getInternalSubset());
			write(out, "]");
		}
		write(out, ">");

	}