Home  >  Article  >  Backend Development  >  Detailed introduction to the DOCTYPE field in XML

Detailed introduction to the DOCTYPE field in XML

黄舟
黄舟Original
2017-04-01 13:58:342503browse

DTDThe declaration always starts with !DOCTYPE, followed by a blank space followed by the name of the document root element. If it is an internal DTD, then a blank space appears [], and the document type definition is enclosed in square brackets. The content of the external DTD is divided into private DTD and public DTD. The private DTD is represented by SYSTEM, followed by the URL of the external DTD. The public DTD is represented by PUBLIC, followed by the DTD public name, followed by the URL of the DTD.

Private DTD

<!DOCTYPErootSYSTEM "http://www.test.org/test.dtd" >

Public DTD

<!DOCTYPEhtmlPUBLIC "-//W3C//DTDXHTML1.0Transitional//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml1-transitional.dtd" >

Public DTD, the DTD name format is "Registration//Organization//Type Tag//Language",

"Registration" indicates whether the organization is registered by the International Organization for Standardization (ISO), + means yes, - means no.

"Organization" is the name of the organization, such as: W3C;

"Type" Generally it is a DTD,

"tag" is a designated public text description, that is, the unique descriptive name of the referenced public text, which can be followed by a version number.

The last "language" is the ISO 639 language identifier of the DTD language, such as: EN means English, ZH means Chinese,

There is a complete list of ISO 639 language identifiers at the following address

For example:

<!DOCTYPEhtmlPUBLIC "-//W3C//DTDXHTML1.0Transitional//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml1-transitional.dtd" >

starts with !DOCTYPE,

html is the name of the document root element,

PUBLIC means it is a public DTD,

Followed by the DTD name, starting with - indicates that it is a non-ISO organization. The organization name is W3C, EN indicates that the DTD language is English,

and finally the DTD URL

Note: Although the DTD file URL can be used Relative URLs can also use absolute URLs, but the recommended standard is to use absolute URLs. On the other hand, for public DTDs, if the interpreter can recognize its name, it will not look at the DTD file on the URL

The above is the detailed content of Detailed introduction to the DOCTYPE field in XML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn