SGML entity
In the Standard Generalized Markup Language (SGML), an entity is a primitive data type, which associates a string with either a unique alias (such as a user-specified name) or an SGML reserved word (such as #DEFAULT ).[src] Entities are foundational to the organizational structure and definition of SGML documents.[src] The SGML specification defines numerous entity types, which are distinguished by keyword qualifiers and context.[src] An entity string value may variously consist of plain text, SGML tags, and/or references to previously defined entities.[src] Certain entity types may also invoke external documents.[src] Entities are called by reference.[src]
In the Standard Generalized Markup Language (SGML), an entity is a primitive data type, which associates a string with either a unique alias (such as a user-specified name) or an SGML reserved word (such as #DEFAULT ).[src] Entities are foundational to the organizational structure and definition of SGML documents.[src] The SGML specification defines numerous entity types, which are distinguished by keyword qualifiers and context.[src] An entity string value may variously consist of plain text, SGML tags, and/or references to previously defined entities.[src] Certain entity types may also invoke external documents.[src] Entities are called by reference.[src] ==Entity types== Entities are classified as general or parameter: A general entity can only be referenced within the document content.[src] A parameter entity can only be referenced within the document type definition (DTD).[src] Entities are also further classified as parsed or unparsed: A parsed entity contains text, which will be incorporated into the document and parsed if the entity is referenced.[src] A parameter entity can only be a parsed entity.[src] An unparsed entity contains any kind of data, and a reference to it will result in the application's merely being notified of the entity's presence; the content of the entity will not be parsed, even if it is text.[src] An unparsed entity can only be external.[src] ===Internal and external entities=== An internal entity has a value that is either a literal string, or a parsed string comprising markup and entities defined in the same document (such as a Document Type Declaration or subdocument).[src] In contrast, an external entity has a declaration that invokes an external document, thereby necessitating the intervention of an entity manager to resolve the external document reference.[src] ====System entities==== An entity declaration may have a literal value, or may have some combination of an optional SYSTEM identifier, which allows SGML parsers to process an entity's string referent as a resource identifier, and an optional PUBLIC identifier, which identifies the entity independent of any particular representation.[src] In XML, a subset of SGML, an entity declaration may not have a PUBLIC identifier without a SYSTEM identifier.[src] ====SGML document entity==== When an external entity references a complete SGML document, it is known in the calling document as an SGML document entity.[src] An SGML document is a text document with SGML markup defined in an SGML prologue (i.e., the DTD and subdocuments).[src] A complete SGML document comprises not only the document instance itself, but also the prologue and, optionally, the SGML declaration (which defines the document's markup syntax and declares the character encoding).[src] ==Syntax== An entity is defined via an entity declaration in a document's document type definition (DTD).[src] For example: This DTD markup declares the following: An internal general entity named greeting1 exists and consists of the string Hello world .[src] An external general entity named greeting2 exists and consists of the text found in the resource identified by the URI file:///hello.txt .[src] An internal parameter entity named greeting3 exists and consists of the string ¡Hola![src] .[src] An internal general entity named greeting4 exists and consists of the string ¡Hola![src] means Hello![src] .[src] Names for entities must follow the rules for SGML names, and there are limitations on where entities can be referenced.[src] Parameter entities are referenced by placing the entity name between % and ; .[src] Parsed general entities are referenced by placing the entity name between " & " and " ; ".[src] Unparsed entities are referenced by placing the entity name in the value of an attribute declared as type ENTITY.[src] The general entities from the example above might be referenced in a document as follows: '&greeting1;' is a common test string.[src] The content of hello.txt is: &greeting2; In Spanish, &greeting4; When parsed, this document would be reported to the downstream application the same as if it has been written as follows, assuming the hello.txt file contains the text Salutations : 'Hello world' is a common test string.[src] The content of hello.txt is: Salutations In Spanish, ¡Hola![src] means Hello![src] A reference to an undeclared entity is an error unless a default entity has been defined.[src] For example: Additional markup constructs and processor options may affect whether and how entities are processed.[src] For example, a processor may optionally ignore external entities.[src] ==Character entities== Standard entity sets for SGML and some of its derivatives have been developed as mnemonic devices, to ease document authoring when there is a need to use characters that are not easily typed or that are not widely supported by legacy character encodings.[src] Each such entity consists of just one character from the Universal Character Set.[src] Although any character can be referenced using a numeric character reference, a character entity reference allows characters to be referenced by name instead of code point.[src] For example, HTML 4 has 252 built-in character entities that do not need to be explicitly declared, while XML has five.[src] XHTML has the same five as XML, but if its DTDs are explicitly used, then it has 253 ( ' being the extra entity beyond those in HTML 4).[src] ==See also== Declarative programming Object (computer science) List of XML and HTML character entity references XML external entity attack ==Notes== ==References== Goldfarb, Charles F.[src] (Ed.).[src] ISO 8879 Review: WG8 N1855.[src] WG8 and Liaisons, 1996.[src] Goldfarb, Charles F., and Yuri Rubinsky (Ed.).[src] The SGML Handbook.[src] Oxford University Press, 1991.[src] ==External links== Entity Management in SGML[src]
57 sentences · 57 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"SGML entity." encyclopegia.org, 2026, https://encyclopegia.org/wiki/sgml-entity. Accessed 26 November 2026.
Chicago
"SGML entity." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/sgml-entity.
APA
encyclopegia.org. (2026). SGML entity. Retrieved November 26, 2026, from https://encyclopegia.org/wiki/sgml-entity
Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON