Document Type Declaration
A Document Type Declaration (DOCTYPE for short) associates a particular SGML or XML document with a Document Type Definition (DTD). In the serialized form of the document, it manifests as a short string of markup that conforms to a particular syntax.
Example
A Document Type Declaration can be found in the source code of every Wikipedia page. For example, the first line of many Wikipedia pages reads as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
This Document Type Declaration says that the document is of type html (a fairly arbitrary name, actually, but if given, the name of the document's root element must match) and that the Document Type Definition for it is named by the public identifier -//W3C//DTD XHTML 1.0 Transitional//EN. Furthermore, if the public identifier is insufficient for locating a copy of the correct DTD, then http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd may be used as another name for it, and a copy of the actual DTD may be retrieved from that location.
See also
- Document Type Definition contains a example
Categories: Software stubs | XML standards