protected Revision parseRevision(String xml, String title)
    {
        // oldid
        int a = xml.indexOf(" revid=\"") + 8;
        int b = xml.indexOf('\"', a);
        long oldid = Long.parseLong(xml.substring(a, b));

        // timestamp
        a = xml.indexOf("timestamp=\"") + 11;
        b = xml.indexOf('\"', a);
        Calendar timestamp = timestampToCalendar(convertTimestamp(xml.substring(a, b)));

        // title
        if (title.isEmpty())
        {
            a = xml.indexOf("title=\"") + 7;
            b = xml.indexOf('\"', a);
            title = decode(xml.substring(a, b));
        }

        // summary
        String summary = null;
        if (!xml.contains("commenthidden=\"")) // not oversighted
        {
            a = xml.indexOf("comment=\"") + 9;
            b = xml.indexOf('\"', a);
            summary = (a == 8) ? "" : decode(xml.substring(a, b));
        }

        // user
        String user2 = null;
        if (xml.contains("user=\""))
        {
            a = xml.indexOf("user=\"") + 6;
            b = xml.indexOf('\"', a);
            user2 = decode(xml.substring(a, b));
        }

        // flags: minor, bot, new
        boolean minor = xml.contains("minor=\"\"");
        boolean bot = xml.contains("bot=\"\"");
        boolean rvnew = xml.contains("new=\"\"");

        // size
        int size;
        if (xml.contains("newlen=")) // recentchanges
        {
            a = xml.indexOf("newlen=\"") + 8;
            b = xml.indexOf('\"', a);
            size = Integer.parseInt(xml.substring(a, b));
        }
        else if (xml.contains("size=\""))
        {
            a = xml.indexOf("size=\"") + 6;
            b = xml.indexOf('\"', a);
            size = Integer.parseInt(xml.substring(a, b));
        }
        else // MW bug 32414/32415? Also, may help for revdeled revisions.
            size = 0;

        Revision revision = new Revision(oldid, timestamp, title, summary, user2, minor, bot, rvnew, size);
        if (xml.contains("rcid=\""))
        {
            // set rcid
            a = xml.indexOf("rcid=\"") + 6;
            b = xml.indexOf('\"', a);
            revision.setRcid(Long.parseLong(xml.substring(a, b)));
        }

        // rollback token; will automatically be null if we cannot rollback
        if (xml.contains("rollbacktoken=\""))
        {
            a = xml.indexOf("rollbacktoken=\"") + 15;
            b = xml.indexOf('\"', a);
            revision.setRollbackToken(xml.substring(a, b));
        }
        return revision;
    }