void parseTextDecl(boolean ignoreEncoding) throws java.lang.Exception
    {
        String encodingName = null;

        // Read an optional version.
        if (tryRead("version")) {
            String version;
            parseEq();
            version = readLiteral(0);
            if (!version.equals("1.0")) {
                error("unsupported XML version", version, "1.0");
            }
            requireWhitespace();
        }

        // Read the encoding.
        require("encoding");
        parseEq();
        encodingName = readLiteral(0);
        checkEncoding(encodingName, ignoreEncoding);

        skipWhitespace();
        require("?>");
    }