Close

XML Document type declaration (DOCTYPE)

[Last Updated: May 25, 2017]

DOCTYPE is a special instructions for the parsers, typically it's used for providing XML validation information by declaring DTD.

Syntax


FPI stands for Formal Public Identifier

It is a specific formatted text that is used to uniquely identify a product, specification or document.

It's a legacy way to identify resources. Now URIs are preferred ways to uniquely identify resources.

Example: "-//W3C//DTD HTML 4.01//EN"

The XML parser needs to resolve FPI. Typically an application would use some sort of catalog file in order to map the PUBLIC identifier to the appropriate system identifier (URI). This mapping can be ignored if a URI is also provided with FPI. In that case FPI might be used for switching modes. For example an HTML layout engine in modern web browsers can decide a layout mode, such as quirks mode or normal mode.

An XHTML example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    ....
</html>


Other uses of DOCTYPE

The document type declaration can also contains external/internal entity definition.

See Also