Information about Document Type Definition
Document Type Definition (DTD), defined slightly differently within the XML and SGML (the language XML was derived from) specifications, is one of several SGML and XML schema languages, and is also the term used to describe a document or portion thereof that is authored in the DTD language. A DTD is primarily used for the expression of a schema via a set of declarations that conform to a particular markup syntax and that describe a class, or type, of SGML or XML documents, in terms of constraints on the structure of those documents. A DTD may also declare constructs that are not always required to establish document structure, but that may affect the interpretation of some documents.
DTD is native to the SGML and XML specifications, and since its introduction other specification languages such as XML Schema and RELAX NG have been released with additional functionality.
As an expression of a schema, a DTD specifies, in effect, the syntax of an "application" of SGML or XML, such as the derivative language HTML or XHTML. This syntax is usually a less general form of the syntax of SGML or XML.
In a DTD, the structure of a class of documents is described via element and attribute-list declarations. Element declarations name the allowable set of elements within the document, and specify whether and how declared elements and runs of character data may be contained within each element. Attribute-list declarations name the allowable set of attributes for each declared element, including the type of each attribute value, if not an explicit set of valid value(s).
The declarations in a DTD are divided into an internal subset and an external subset. The declarations in the internal subset are embedded in the Document Type Declaration in the document itself. The declarations in the external subset are located in a separate text file. The external subset may be referenced via a public identifier and/or a system identifier. Programs for reading documents may not be required to read the external subset.
Here is an example of a Document Type Declaration that encapsulates an internal subset consisting of a single entity declaration:
All HTML 4.01 documents are expected to conform to one of three SGML DTDs. The public identifiers of these DTDs are constant and are as follows: The system identifiers of these DTDs, if present in the Document Type Declaration, will be URI references. System identifiers can vary, but are expected to point to a specific set of declarations in a resolvable location. SGML allows for public identifiers to be mapped to system identifiers in catalogs that are optionally made available to the URI resolvers used by document parsing software.
A common misconception is that non-validating XML parsers are not required to read DTDs, when in fact, the DTD must still be scanned for correct syntax as well as for declarations of entities and default attributes. A non-validating parser may, however, elect not to read external entities, including the external subset of the DTD. If the XML document depends on declarations found only in external entities, it should assert
Taking this line by line, it says:
An example of an XML file which makes use of and conforms to this DTD follows. It assumes the DTD is identifiable by the relative URI reference "example.dtd":
It is possible to render this in an XML-enabled browser (such as IE5 or Mozilla) by pasting and saving the DTD component above to a text file named example.dtd and the XML file to a differently-named text file, and opening the XML file with the browser. The files should both be saved in the same directory. However, many browsers do not check that an XML document conforms to the rules in the DTD; they are only required to check that the DTD is syntactically correct. For security reasons, they may also choose not to read the external DTD.
DTD is native to the SGML and XML specifications, and since its introduction other specification languages such as XML Schema and RELAX NG have been released with additional functionality.
As an expression of a schema, a DTD specifies, in effect, the syntax of an "application" of SGML or XML, such as the derivative language HTML or XHTML. This syntax is usually a less general form of the syntax of SGML or XML.
In a DTD, the structure of a class of documents is described via element and attribute-list declarations. Element declarations name the allowable set of elements within the document, and specify whether and how declared elements and runs of character data may be contained within each element. Attribute-list declarations name the allowable set of attributes for each declared element, including the type of each attribute value, if not an explicit set of valid value(s).
Associating DTDs with documents
A DTD is associated with an XML document via a Document Type Declaration, which is a tag that appears near the start of the XML document. The declaration establishes that the document is an instance of the type defined by the referenced DTD.The declarations in a DTD are divided into an internal subset and an external subset. The declarations in the internal subset are embedded in the Document Type Declaration in the document itself. The declarations in the external subset are located in a separate text file. The external subset may be referenced via a public identifier and/or a system identifier. Programs for reading documents may not be required to read the external subset.
Examples
Here is an example of a Document Type Declaration containing both public and system identifiers:>
Here is an example of a Document Type Declaration that encapsulates an internal subset consisting of a single entity declaration:
> ]> ]>
All HTML 4.01 documents are expected to conform to one of three SGML DTDs. The public identifiers of these DTDs are constant and are as follows: The system identifiers of these DTDs, if present in the Document Type Declaration, will be URI references. System identifiers can vary, but are expected to point to a specific set of declarations in a resolvable location. SGML allows for public identifiers to be mapped to system identifiers in catalogs that are optionally made available to the URI resolvers used by document parsing software.
XML DTDs and schema validation
The XML DTD syntax is one of several XML schema languages.A common misconception is that non-validating XML parsers are not required to read DTDs, when in fact, the DTD must still be scanned for correct syntax as well as for declarations of entities and default attributes. A non-validating parser may, however, elect not to read external entities, including the external subset of the DTD. If the XML document depends on declarations found only in external entities, it should assert
standalone="no" in its XML declaration.
Differences between SGML and XML DTD syntax
The syntax of SGML and XML DTDs are very similar, but not identical.- The SGML declaration for HTML 4.01, for example, allows its DTD to specify whether elements require start and end tags, which would be impossible in an XML DTD. Consider the following element declaration for HTML 4.01:
BR - O EMPTY -- forced line break -->
The-after the element name "BR" means a start tag,<BR>, is required and theOafter that makes the end tag,</BR>optional (in fact, the W3C recommendation forbids the end tag). On the other hand, XML languages share a common SGML declaration, one that simplifies the DTD syntax but disallows any tag omission (XML itself also prohibits comments within the declaration such as-- forced line break --). Thus, the XHTML 1.0 specification which specifies an XML-based version of HTML, only allows for
and the element must be written as either<br></br>or in a special shortened format as<br />. In addition, XML element tags are case-sensitive, so the HTMLBRelement must be written in lowercase in XHTML as defined above (br). - Element declarations in XML cannot exclude other elements. For example, in HTML,
defines aFORMelement that includes certain elements (with an SGML entity) but, due to the-(FORM)part, cannot include otherFORMs. In XHTML theFORMis thus defined as
which simply includes certain elements..
XML DTD Example
An example of a very simple XML DTD to describe a list of persons is given below:>
Taking this line by line, it says:
people_listis a valid element name, and an instance of such an element contains any number ofpersonelements. The*denotes there can be 0 or morepersonelements within thepeople_listelement.personis a valid element name, and an instance of such an element contains one element namedname, followed by one namedbirthdate(optional), thengender(also optional) andsocialsecuritynumber(also optional). The?indicates that an element is optional. The reference to thenameelement name has no?, so apersonelement must contain anameelement.nameis a valid element name, and an instance of such an element contains parseable character data (#PCDATA).birthdateis a valid element name, and an instance of such an element contains character data.genderis a valid element name, and an instance of such an element contains character data.socialsecuritynumberis a valid element name, and an instance of such an element contains character data.
An example of an XML file which makes use of and conforms to this DTD follows. It assumes the DTD is identifiable by the relative URI reference "example.dtd":
>Fred Bloggs 27/11/2008 Male
It is possible to render this in an XML-enabled browser (such as IE5 or Mozilla) by pasting and saving the DTD component above to a text file named example.dtd and the XML file to a differently-named text file, and opening the XML file with the browser. The files should both be saved in the same directory. However, many browsers do not check that an XML document conforms to the rules in the DTD; they are only required to check that the DTD is syntactically correct. For security reasons, they may also choose not to read the external DTD.
DTD criticisms and alternatives
While DTD support in XML tools is widespread due to its inclusion in the XML 1.0 standard, it is seen as limited for the following reasons:- No support for newer features of XML — most importantly, namespaces.
- Lack of expressivity. Certain formal aspects of an XML document cannot be captured in a DTD.
- Custom non-XML syntax to describe the schema, inherited from SGML. (namely 'Extended Backus Naur Form')
- XML Schema, also referred to as XML Schema Definition (XSD), has achieved Recommendation status within the W3C.
- RELAX NG, which is also a part of DSDL, is an ISO international standard.
- Document Structure Description (DSD), attempts to combine an expressive schema balanced with ease of use.
See also
External links
- Definition of the XML document type declaration from Extensible Markup Language (XML) 1.0 (Fourth Edition) on W3C.org
- XML DTD Quick Reference
- The XML FAQ has some DTD-specific entries
- DTD Tutorial from W3schools
- Zvon DTD Tutorial - in 7 languages
- Interactive DTD tutorial from XMLzoo
- Different doctypes for HTML
- XMLPatterns.com - Design Patterns for developing DTDs
- dtd2xs Converts a DTD to an XML Schema
- DTD Tools for editing, generating and converting DTDs
- PlainXML Converts a DTD to an POJO objects
Extensible Markup Language
File extension:
MIME type:
Uniform Type Identifier: public.xml
Developed by: World Wide Web Consortium
Type of format: Markup language
Extended from: SGML
..... Click the link for more information.
File extension:
.xmlMIME type:
application/xml, text/xml (deprecated)Uniform Type Identifier: public.xml
Developed by: World Wide Web Consortium
Type of format: Markup language
Extended from: SGML
..... Click the link for more information.
Standard Generalized Markup Language
File extension: none
MIME type:
Uniform Type Identifier: public.xml
Type of format: metalanguage
Extended from: GML
Extended to: HTML, XML
Standard(s): ISO 8879
..... Click the link for more information.
File extension: none
MIME type:
application/sgml, text/sgmlUniform Type Identifier: public.xml
Type of format: metalanguage
Extended from: GML
Extended to: HTML, XML
Standard(s): ISO 8879
..... Click the link for more information.
XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself.
..... Click the link for more information.
..... Click the link for more information.
markup language provides a way to combine a text and extra information about it. The extra information, including structure, layout, or other information, is expressed using markup, which is typically intermingled with the primary text.
..... Click the link for more information.
..... Click the link for more information.
XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself.
..... Click the link for more information.
..... Click the link for more information.
In computing, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML, based on Murata Makoto's RELAX and James Clark's TREX. A RELAX NG schema specifies a pattern for the structure and content of an XML document.
..... Click the link for more information.
..... Click the link for more information.
HTML (Hypertext Markup Language)
File extension:
MIME type:
Type code: TEXT
..... Click the link for more information.
File extension:
.html, .htmMIME type:
text/htmlType code: TEXT
..... Click the link for more information.
XHTML
File extension:
..... Click the link for more information.
File extension:
.xhtml, .xht, .html, ...... Click the link for more information.
In programming languages a data type defines a set of values and the allowable operations on those values[1]. For example, in the Java programming language, the "int" type represents the set of 32-bit integers ranging in value from -2,147,483,648 to 2,147,483,647, and
..... Click the link for more information.
..... Click the link for more information.
A Document Type Declaration, or DOCTYPE, is an instruction that associates a particular SGML or XML document (for example, a webpage) with a Document Type Definition (DTD) (for example, the formal definition of a particular version of HTML).
..... Click the link for more information.
..... Click the link for more information.
A public identifier is a document processing construct in SGML and XML.
In HTML and XML, a public identifier is meant to be universally unique within its application scope. It typically occurs in a Document Type Declaration.
..... Click the link for more information.
In HTML and XML, a public identifier is meant to be universally unique within its application scope. It typically occurs in a Document Type Declaration.
..... Click the link for more information.
A system identifier is a document processing construct introduced in the HyTime markup language as a supplement to SGML. It was subsequently incorporated into the HTML and XML markup languages.
..... Click the link for more information.
..... Click the link for more information.
Uniform Resource Identifier (URI), is a compact string of characters used to identify or name a resource. The main purpose of this identification is to enable interaction with representations of the resource over a network, typically the World Wide Web, using specific
..... Click the link for more information.
..... Click the link for more information.
XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself.
..... Click the link for more information.
..... Click the link for more information.
HTML (Hypertext Markup Language)
File extension:
MIME type:
Type code: TEXT
..... Click the link for more information.
File extension:
.html, .htmMIME type:
text/htmlType code: TEXT
..... Click the link for more information.
BR or Br may be:
..... Click the link for more information.
- BR Beautiful Revolution, a Korean cosmetic company
- BR, symbol used by Petrobras Distribuidora, the fuel retail division of Petrobras
- BR Korea, ice cream company Baskin-Robbins in South Korea
..... Click the link for more information.
Text sometimes exhibits case sensitivity, that is, words can differ in meaning based on the differing use of uppercase and lowercase letters. Words with capital letters don't always have the same meaning as words with lowercase letters.
..... Click the link for more information.
..... Click the link for more information.
entity is something that has a distinct, separate existence, though it need not be a material existence. In particular, abstractions and legal fictions are usually regarded as entities. In general, there is also no presumption that an entity is animate.
..... Click the link for more information.
..... Click the link for more information.
Render or Rendering may refer to:
..... Click the link for more information.
- In the visual arts,
- Artistic rendering is the process by which a work of art is created.
..... Click the link for more information.
A web browser is a software application that enables a user to display and interact with text, images, videos, music and other information typically located on a Web page at a website on the World Wide Web or a local area network.
..... Click the link for more information.
..... Click the link for more information.
Windows Internet Explorer (formerly Microsoft Internet Explorer abbreviated MSIE), commonly abbreviated to IE, is a series of proprietary graphical web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems
..... Click the link for more information.
..... Click the link for more information.
Mozilla was the official, public, original name of Mozilla Application Suite by the Mozilla Foundation, currently known as SeaMonkey suite.
In informal use it has been used in a number of ways and in combination with other phrases, though all of them have been
..... Click the link for more information.
In informal use it has been used in a number of ways and in combination with other phrases, though all of them have been
..... Click the link for more information.
XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself.
..... Click the link for more information.
..... Click the link for more information.
In computing, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML, based on Murata Makoto's RELAX and James Clark's TREX. A RELAX NG schema specifies a pattern for the structure and content of an XML document.
..... Click the link for more information.
..... Click the link for more information.
Document Structure Description, or DSD, is a schema language for XML, that is, a language for describing valid XML documents. It's an alternative to DTD or the W3C XML Schema.
An example of DSD in its simplest form:
<dsd xmlns="http://www.brics.dk/DSD/2.
..... Click the link for more information.
An example of DSD in its simplest form:
<dsd xmlns="http://www.brics.dk/DSD/2.
..... Click the link for more information.
A Document Type Declaration, or DOCTYPE, is an instruction that associates a particular SGML or XML document (for example, a webpage) with a Document Type Definition (DTD) (for example, the formal definition of a particular version of HTML).
..... Click the link for more information.
..... Click the link for more information.
The semantic web is an evolving extension of the World Wide Web in which web content can be expressed not only in natural language, but also in a format that can be read and used by software agents, thus permitting them to find, share and integrate information more easily.
..... Click the link for more information.
..... Click the link for more information.
XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself.
..... Click the link for more information.
..... Click the link for more information.
Depending on the context Pojo refers to
..... Click the link for more information.
- the Swedish name for the Finish municipality Pohja
- in computer science, an acronym for Plain Old Java Object.
- Pojo.com, an anime and game website, of which the main feature is the Pojo messageboard.
..... Click the link for more information.
This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus