void parseDocument() throws java.lang.Exception
    {
        char c;

        parseProlog();
        require('<');
        parseElement();
        try {
            parseMisc(); //skip all white, PIs, and comments
            c = readCh(); //if this doesn't throw an exception...
            error("unexpected characters after document end", c, null);
        } catch (EOFException e) {
            return;
        }
    }