private void parseDocument() throws Exception {
        try { // added by MHK
            boolean sawDTD = parseProlog();
            require('<');
            parseElement(!sawDTD);
        } catch (EOFException ee) { // added by MHK
            fatal("premature end of file", "[EOF]", null);
        }

        try {
            parseMisc(); // skip all white, PIs, and comments
            char c = readCh(); // if this doesn't throw an exception...
            fatal("unexpected characters after document end", c, null);
        } catch (EOFException e) {
            if (characterHandler != null) {
                characterHandler.end();
            }
            if (normalizationChecker != null) {
                normalizationChecker.end();
            }
            return;
        }
    }
Parse an XML document.

<pre>
 [1] document ::= prolog element Misc*
</pre>

<p>
This is the top-level parsing function for a single XML document. As a
minimum, a well-formed document must have a document element, and a valid
document must have a prolog (one with doctype) as well.
src/nu/validator/gnu/xml/aelfred2/XmlParser.java