What Is DTD (Document Type Definition)
This section provides a quick introduction of DTD (Document Type Definition) - a language that can be used to define a document type for SGML or XML documents.
What Is DTD (Document Type Definition)?:
DTD is a language that can be used to define a document type for SGML (Standard Generalized Markup Language) documents.
Since XML (Extensible Markup Language) is a subset of SGML, DTD can also be used to define a document type for XML documents.
If an XML document is said to be valid against a DTD document type, all elements, attributes and entities in the XML document
must meet their declared formats described in the DTD document type.
Main features of DTD:
- DTD is a simple language with only 4 types of statements: DOCTYPE, ELEMENT, ATTLIST, and ENTITY.
- One DOCTYPE statement defines one document type.
- Within the DOCTYPE statement, one or more ELEMENT statements, some ATTLIST statements and some ENTITY statements
are included to define details of the document type.
- DTD statements that define the document type can be included inside the XML file.
- DTD statements that define the document type can be stored as a separate file and linked to the XML file.
Here is an example of DTD document type:
<!DOCTYPE p [
<!ELEMENT p ANY>
This example shows:
- The document type is defined with the root element named as "p".
- The element "p" is defined to have "any" sub elements, text content, and attributes.
Table of Contents
About This Book
Introduction of XML (eXtensible Markup Language)
XML File Syntax
XML File Browsers
XML-JSON Document Conversion
DOM (Document Object Model) Programming Interface
SAX (Simple API for XML) Programming Interface
►DTD (Document Type Definition) Introduction
►What Is DTD (Document Type Definition)
XML Files with Embedded DTD Statements
XML Files with Linked External DTD Files
Validating an XML File against a DTD Document Type
Syntaxes of DTD Statements
Validating an XML Document against the Specified DTD Document Type
XSD (XML Schema Definition) Introduction
Syntaxes of XSD Statements
Validating XML Documents Against Specified XML Schemas
XSL (Extensible Stylesheet Language) Introduction
XSLT (XSL Transformations) Introduction
Java Implementation of XSLT
XPath (XML Path) Language
XSLT Elements as Programming Statements
Control and Generate XML Element in the Result
PHP Extensions for XML Manipulation
XML Notepad - XML Editor
XML Tools Plugin for Notepad++
XML Plugin Packages for Atom Editor
XML 1.1 Changes and Parsing Examples
Full Version in PDF/EPUB