DTD

Jump to navigation Jump to search

Definiton

Document Type Definition (DTD) is an SGML and XML schema language. A DTD is used to define and describe the elements and groups thereof and the order in which they are allowed (or not) to appear within an SGML or XML document. A document must conform to the specifications of an associated DTD (i.e. be valid) before it can be processed for output.

See also: DTD tutorial

Structure

DTDs are made up of element and attribute-list declarations.

  • elements declare what types of data, how and whether or not they are allowed within other declared elements.
  • attribute-lists declare the attributes allowed for each element and their value type.

For example, the following XML document would be valid according to the DTD that follows.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE people_list SYSTEM "example.dtd">
<people>
  <person gender="female">
     <name>
        <first>Jane</first>
        <middle>Jean</middle>
        <last>Doe</last>
        <maidenName></maidenName>
     </name>
  </person>
<people>

Corresponding DTD:

<!ELEMENT people (person*)> //* one or more person must appear in the list
<!ELEMENT person (name)> // person element must have exactly one name element
 <!ATTLIST person  gender CDATA #REQUIRED> //the person element must have an attribute gender
<!ELEMENT name (first, middle?, last, maidenName?)> //middle and maidenName elements are optional
<!ELEMENT first (#PCDATA)>
<!ELEMENT middle (#PCDATA)>
<!ELEMENT last (#PCDATA)>
<!ELEMENT maidenName (#PCDATA)>

None of the above documents define the style of the documents. They describe the content and its syntactical expression (descriptive language), not its form or style (unlike HTML or XHTML that provide built-in basic formatting). The style and form of the document is attributed during processing (e.g. through CSS, XSLT, )

Interpretive software can used to convert the "structured" document for multiple output formats including print and web pages containing HTML (hypertext markup language) or directly XML (extensible markup language).

See the DTD tutorial for details.

Alternatives

Use of DTDs in education

DTDs and other schema languages lend themselves to particular learning activities and pedagogical scenarios where either knowledge representations and requirements, the creation of ontologies or the definition of rubrics are individually or collaboratively constructed.

Examples

The English Department at the University of Georgia has composition students collaboratively create their own DTDs from templates, that describe the components and evaluation criteria for various writing genres and such as narrative, expository or argumentative writing.

Educational modelling languages rather tend to be specified with Relax NG or XML Schema ...

others needed
KBenetos

References


Warning-noto.svg

Content of this article has been taken from EduTechWiki (en) or EduTechWiki (fr) at the date indicated in the history. DKS was the main founder and main contributor of EduTechWiki. If you cite this page you also must cite and credit EduTechWiki, according to the CC BY-NC-SA license. View the pageinfo-toolboxlink for this article.