is default-entity

operator

Return type: Switch
Returns:       Returns true if the entity is a default entity being used, and false otherwise. Replacing is with isnt will reverse the results.

Syntax
entity (is | isnt) default-entity


Purpose

An entity test to determine whether the current entity has been assigned the value of the general default entity. The current entity will take the value of the general default entity if it was not defined.

An SGML DTD can contain a declaration for the default general entity. Any general entity reference that contains a name that was not defined as a general entity in the DTD is "re-routed" to the default general entity. The entity names in entity and entities attribute values are also satisfied using the default general entity. It is important to note that even though an entity has the default entity value, it retains its own name for purposes of identification.

If there is no default general entity, a general entity reference containing an undefined name is an error. An undefined parameter entity is always an error. There is no such thing as a "default parameter entity".

The default general entity can be any type of general entity: internal, external, text, or non-SGML. It is the job of the DTD designer and the creators of SGML documents to ensure that whenever an undefined general entity is referenced, or its name is used in an entity or entities attribute value, the default general entity is the appropriate type. For example, if an undefined entity name is used as an entity value, the default general entity must be a non-SGML entity (CDATA, SDATA, NDATA, or SUBDOC)) and not a text entity, or an error will result.

This example will always output the text "[default]" for references to an undefined general entity. It will do so independently of any public or system identifiers the default general entity may have, as long as the default general entity is an external text entity. In addition, it displays a message on the error output indicating which undefined entities are referenced in the document:

  external-text-entity #implied when entity is default-entity
     output "[default]"
     put #error "General entity %q is undefined.%n"

Related Concepts