external-text-entity #document

rule

Syntax
external-text-entity #document


Purpose

A rule that establishes a framework for explicitly providing an entire "SGML document entity" to the SGML parser. It cannot be used in a process program, nor a module.

If a context-translate or up-translate program contains an external-text-entity #document rule, there is no automatic submit of #main-input. You can submit it yourself if you need to. The external-text-entity #document rule is used for processing the SGML document entity.

The external-text-entity #document rule is different from other kinds of external-text-entity rules:

  • The name #document can't be mixed with entity names or with the keywords #dtd, #charset, #capacity, or #syntax in the header of the rule.
  • If there are any external-text-entity #document rules in the program, one must be selected to provide the SGML document. (Having more than one or none that is selectable causes an error.)
  • A program that contains an external-text-entity #document rule must not contain any find-start or find-end rules, because there is no reason for them ever to be performed.
  • An external-text-entity #document rule only applies to the main SGML document, and not to documents whose parsing was initiated by a do sgml-parse. Thus, the #current-output inherited by an external-text-entity #document rule is always the #sgml stream created by context-translate, down-translate, or up-translate.
  • The "%q" format item cannot be used in an external-text-entity #document rule because such a text entity does not have a name.