Entities are classified as general or parameter: • A
general entity can only be referenced within the document content. • A
parameter entity can only be referenced within the
document type definition (DTD). 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. A parameter entity can only be a parsed entity. • 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. An unparsed entity can only be external.
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). 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.
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. In
XML, a subset of
SGML, an entity declaration may not have a PUBLIC identifier without a SYSTEM identifier.
SGML document entity When an external entity references a complete SGML document, it is known in the calling document as an
SGML document entity. An SGML document is a text document with SGML markup defined in an SGML prologue (i.e., the DTD and subdocuments). 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). ==Syntax==