Sustainability of Digital Formats: Planning for Library of Congress Collections

Introduction | Sustainability Factors | Content Categories | Format Descriptions | Contact
Format Description Categories >> Browse Alphabetical List

XML Document Type Definition (DTD)

>> Back
Table of Contents
Format Description Properties Explanation of format description terms

Identification and description Explanation of format description terms

Full name XML Document Type Definition (DTD)
Description

An XML Document Type Definition is a formal expression (in XML) of the structural constraints for a class of XML documents. The DTD language constructs are element and attribute-list declarations. Element declarations name the elements allowed within a document of this type, and specify whether and how declared elements and runs of character data may be contained within each element. Attribute-list declarations name the permitted attributes for each declared element, including the type of each attribute value, if not an explicit set of valid value(s). A DTD is associated with an XML document via a Document Type Declaration, which is a tag that appears near the start of the XML document. The declaration establishes that the document is an instance of the type defined by the referenced DTD. These declarations within an XML document can be either internal or external. Internal DTD declarations are stated at the beginning of the XML document and must be wrapped in the <!DOCTYPE> definition. An internal declaration example from the W3schools DTD tutorial is as follows:

<?xml version="1.0"?>

<!DOCTYPE note [

<!ELEMENT note (to,from,heading,body)>

<!ELEMENT from (#PCDATA)>

<!ELEMENT heading (#PCDATA)>

<!ELEMENT body (#PCDATA)>

]>

<note>

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend</body>

</note>

DTDs can also be declared in an external file at the beginning of the XML document. Similar to internal declarations, they must be wrapped in the <!DOCTYPE> definition. An example of an external DTD declaration is as follows:

<?xml version="1.0"?>

<!DOCTYPE note SYSTEM "note.dtd">

The DTD file that is referenced in the external declaration is structured as the internal declaration example above with defined elements for the note, to, from, heading, and body fields.

Relationship to other formats
    Subtype of XML, Extensible Markup Language

Local use Explanation of format description terms

LC experience or existing holdings LC has developed and/or used various XML DTDs since the mid 1990s. Examples include: the EAD Document Type Definition (DTD), a standard for encoding archival finding aids (now in an XML version) and the NCBI/NLM Journal Archiving and Interchange DTD. The Mandatory Deposit of Electronic-Only Books documentation includes the NLM DTD.
LC preference According to the Recommended Formats Statement, for both preferred and acceptable formats for Textual Works - Digital, XML-based formats should include or make accessible DTDs and schemas. Widely used DTDs such as TEI and DocBook are listed as preferred for XML-based formats, while SGML Document Type Definition associated DTDs are acceptable. Additionally, for Textual Works- Electronic Serials, XML-based formats should include or make accessible DTDs, schemas, and associated stylesheets.

Sustainability factors Explanation of format description terms

Disclosure The language for expressing DTDs is defined within the specification of XML.
    Documentation Extensible Markup Language (XML) 1.0
Adoption Widely adopted for specification of document-centric XML document types and use in publishing. The various versions of HTML are defined through DTDs. See list of HTML and XHTML Document Type Definitions at University of Toronto. Examples of other DTDs in widespread use within particular communities include News Industry Text Format (NITF), DTB (Digital Talking Book), and the NCBI/NLM Journal Archiving and Interchange DTD. w3 schools, a widely used site for web development skill building, provides tutorials for learning about DTDs.
    Licensing and patents None
Transparency See XML.
Self-documentation Comments as to purpose, structure, etc. can be embedded in DTD files.
External dependencies None
Technical protection considerations None

Quality and functionality factors Explanation of format description terms

Text
Normal rendering DTDs can be viewed and searched as normal text.

DTDs are not strictly "normal" text, since their function is to support the creation, validation, and manipulation of documents in the class they define. Quality and functionality factors are typically assessed on the basis of a particular DTD and the fitness of the defined document class for the intended purpose.

Other
Format specification A DTD has the special purpose of defining a class of XML documents.

File type signifiers and format identifiers Explanation of format description terms

Tag Value Note
Filename extension dtd
See RFC 3023 for further details.
Internet Media Type application/xml-dtd
See RFC 3023 for further details.
Pronom PUID x-fmt/315
See http://www.nationalarchives.gov.uk/PRONOM/x-fmt/315.
Wikidata Title ID Q212327
See https://www.wikidata.org/wiki/Q212327.

Notes Explanation of format description terms

General From Wikipedia, "As of 2009, 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. 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."
History Derived from SGML Document Type Definition specification language.

Format specifications Explanation of format description terms


Useful references

URLs

Books, articles, etc.

Last Updated: 04/30/2021