ArticleslgStudy

science

SGML entity

SGML entity is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand SGML entity rather than just read about it. In short: 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). Entities are foundational to the organizational structure and definition of SGML documents.

Key takeaways

  • SGML entity belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect SGML entity to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of SGML entity from memory before moving on to harder problems.

Reference excerpt

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). Entities are foundational to the organizational structure and definition of SGML documents. The SGML specification defines numerous entity types, which are distinguished by keyword qualifiers and context. An entity string value may variously consist of plain text, SGML tags, and/or references to previously defined entities. Certain entity types may also invoke external documents. Entities are called by reference.

Entity types 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

An entity is defined via an entity declaration in a document's document type definition (DTD). For example:

This DTD markup declares the following:

An internal general entity named greeting1 exists and consists of the string Hello world. An external general entity named greeting2 exists and consists of the text found in the resource identified by the URI file:///hello.txt. An internal parameter entity named greeting3 exists and consists of the string ¡Hola!. An internal general entity named greeting4 exists and consists of the string ¡Hola! means Hello!. Names for entities must follow the rules for SGML names, and there are limitations on where entities can be referenced. Parameter entities are referenced by placing the entity name between % and ;. Parsed general entities are referenced by placing the entity name between "&" and ";". Unparsed entities are referenced by placing the entity name in the value of an attribute declared as type ENTITY. The general entities from the example above might be referenced in a document as follows:

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:

A reference to an undeclared entity is an error unless a default entity has been defined. For example:

Additional markup constructs and processor options may affect whether and how entities are processed. For example, a processor may optionally ignore external entities.

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. Each such entity consists of just one character from the Universal Character Set. 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. For example, HTML 4 has 252 built-in character entities that do not need to be explicitly declared, while XML has five. 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).

See also Declarative programming Object (computer science) List of XML and HTML character entity references XML external entity attack

Notes

References Goldfarb, Charles F. (Ed.). ISO 8879 Review: WG8 N1855. WG8 and Liaisons, 1996. Goldfarb, Charles F., and Yuri Rubinsky (Ed.). The SGML Handbook. Oxford University Press, 1991.

External links Entity Management in SGML

Worked examples

Example 1 — a first encounter with SGML entity

Start with the simplest possible case. Write down what SGML entity claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to SGML entity before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about SGML entity ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of SGML entity

In research
SGML entity appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses SGML entity in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
SGML entity is common in secondary-school and first-year university syllabi. It links to neighbouring topics Markup languages, SGML, so understanding it makes those chapters shorter.
In everyday life
Look for SGML entity outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study SGML entity in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what SGML entity means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain SGML entity out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is SGML entity in simple terms?

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). Entities are foundational to the organizational structure and definition of SGML…

Why does SGML entity matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study SGML entity?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on SGML entity.

Tags

  • Markup languages
  • SGML

Keep exploring