XML - Document Type (Definition|Declaration) (DTD)

1 - About

Document Type Definition (DTD) is a grammar (language) that defines the schema (ie data structure) of an XML document.


3 - Syntax

The syntax is a set of markup declarations that define a document type for SGML-family markup languages (SGML, XML, HTML).

DTDs were a precursor to XML schemas and have a similar function, although different capabilities.

A DTD can be declared inline inside an XML document, or as an external reference.

The document type declaration MUST appear before the first element in the document.

The document type declaration can point to an external subset (a special kind of external entity) containing:

  • markup declarations,
  • or can contain the markup declarations directly in an internal subset,
  • or can do both.

The DTD for a document consists of both subsets taken together.

DTD are context-free grammars

4 - Markup Declaration

A markup declaration is:

These declarations may be contained in whole or in part within parameter entities

5 - Element Relation Ship

Declaration Relationship (Cardinality)
<!ELEMENT master (sub)> One and only once
<!ELEMENT master (sub+)> One or more
<!ELEMENT master (sub*)> Zero or more
<!ELEMENT master (sub?)> Zero or one

6 - Documentation / Reference

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap