public void handleXmlDeclaration(
            final char[] buffer,
            final int keywordOffset, final int keywordLen,
            final int keywordLine, final int keywordCol,
            final int versionOffset, final int versionLen,
            final int versionLine, final int versionCol,
            final int encodingOffset, final int encodingLen,
            final int encodingLine, final int encodingCol,
            final int standaloneOffset, final int standaloneLen,
            final int standaloneLine, final int standaloneCol,
            final int outerOffset, final int outerLen,
            final int line, final int col)
            throws ParseException {

        if (this.validateProlog && (this.prologPresenceForbidden || this.xmlDeclarationPresenceForbidden)) {
            throw new ParseException(
                    "An XML Declaration has been found, but it wasn't allowed",
                    line, col);
        }

        if (this.validateProlog) {

            if (this.validPrologXmlDeclarationRead) {
                throw new ParseException(
                        "Malformed markup: Only one XML Declaration can appear in document",
                        line, col);
            }
            if (this.validPrologDocTypeRead) {
                throw new ParseException(
                        "Malformed markup: XML Declaration must appear before DOCTYPE",
                        line, col);
            }
            if (this.elementRead) {
                throw new ParseException(
                        "Malformed markup: XML Declaration must appear before any " +
                        "elements in document",
                        line, col);
            }

        }

        if (this.validateProlog) {
            this.validPrologXmlDeclarationRead = true;
        }

        getNext().handleXmlDeclaration(buffer, keywordOffset, keywordLen, keywordLine,
                keywordCol, versionOffset, versionLen, versionLine, versionCol,
                encodingOffset, encodingLen, encodingLine, encodingCol,
                standaloneOffset, standaloneLen, standaloneLine, standaloneCol,
                outerOffset, outerLen, line, col);

    }