parseDocument method

Document? parseDocument()

Implementation

Document? parseDocument() {
  var doctype = parseDoctype();

  if (doctype == null) {
    var root = parseElement();
    if (root == null) return null;
    return Document(null, root);
  }

  var root = parseElement();

  if (root == null) {
    errors.add(JaelError(JaelErrorSeverity.error,
        'Missing root element after !DOCTYPE declaration.', doctype.span));
    return null;
  }

  return Document(doctype, root);
}