Glossary · 4 · Structure and semantics
Content model
Also known as: Element content model
German: Inhaltsmodell
In structured authoring, a content model is the set of rules that specifies which child elements, text and attributes an element may contain, in what order and how often; it is declared in a document type definition, an XML Schema or a RELAX NG schema and is enforced when documents are validated.
- Structured authoring
- Markup
- Standards
In one sentence
A content model specifies which elements may occur inside an element, in what order and how often, as declared in a DTD, XML Schema or RELAX NG.
Example
The content model of a procedure element may require one title, an optional prerequisites section and one or more steps, each step with exactly one command and an optional result; a step without a command fails validation.
How it applies
- Definition in the standards: The XML 1.0 specification calls the constraint on an element type with element content “a content model, a simple grammar governing the allowed types of the child elements and the order in which they are allowed to appear.” The notion comes from SGML (ISO 8879:1986) and was carried into XML. XML Schema and RELAX NG express content models with their own syntax and add data types and further constraints.
- In structured authoring: The content model is what makes structured authoring structured: the editor offers only the elements allowed at the cursor position, and schema validation rejects documents that break the rules. In DITA, each topic type such as DITA task has its own content model, and DITA constraints and DITA specialization narrow or extend it.
- Machinery and software documentation: Content models can require that every procedure has a purpose statement, that a hazard statement contains a signal word and a consequence, or that every API reference names its parameters. Rules that a grammar cannot express, for example co-occurrence conditions, are checked with rule languages such as Schematron. A valid document is structurally correct; it is not thereby correct in content or compliant.
Content model vs. information model
A content model is a formal grammar for one element or document type. An information model describes what information exists, of what types and with what relations, independent of a particular markup; content models are one way of implementing parts of it. A schema is the document that holds the content models of a vocabulary.
External references
- W3C, Extensible Markup Language (XML) 1.0, section 3.2.1 “Element Content”: https://www.w3.org/TR/xml/
- W3C, XML Schema Definition Language (XSD) 1.1 Part 1: Structures: https://www.w3.org/TR/xmlschema11-1/
- OASIS, RELAX NG Specification (2001): https://relaxng.org/spec-20011203.html