Document type definition - Wikipedia, the free encyclopedia


** Document type definition **

From Wikipedia, the free encyclopedia
Jump to: navigation, search

A *document type definition* (*DTD*) is a set of /markup declarations/ that
define a /document type/ for an SGML-family markup language (SGML, XML,

A Document Type Definition (DTD) defines the legal building blocks of an
XML document. It defines the document structure with a list of legal
elements and attributes. A DTD can be declared inline inside an XML
document, or as an external reference. ^[1]

XML uses a subset of SGML DTD.

As of 2009^[update], newer XML namespace-aware schema languages (such as
W3C XML Schema and ISO RELAX NG) have largely superseded DTDs. A
namespace-aware version of DTDs is being developed as Part 9 of ISO
DSDL[1]. DTDs persist in applications that need special publishing
characters, such as the XML and HTML Character Entity References, which
derive from larger sets defined as part of the ISO SGML standard effort.


· 1 Associating DTDs with documents

· 1.1 Examples

· 2 Markup declarations

· 2.1 Element type declarations
· 2.2 Attribute list declarations
· 2.3 Entity declarations
· 2.4 Notation declarations

· 3 XML DTDs and schema validation
· 4 XML DTD schema example
· 5 Security
· 6 See also
· 7 References
· 8 External links

*Associating DTDs with documents[edit]*

A DTD is associated with an XML or SGML document by means of a document
type declaration (DOCTYPE). The DOCTYPE appears in the syntactic fragment
/doctypedecl/ near the start of an XML document.^[2] The declaration
establishes that the document is an instance of the type defined by the
referenced DTD.

DTDs make two sorts of declaration:

· an optional /external subset/
· an optional /internal subset/



© 2005-2019