|
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. The Extensible Markup Language (XML) is a W3C-recommended general-purpose markup language that supports a wide variety of applications. ...
The Standard Generalized Markup Language (SGML) is a metalanguage in which one can define markup languages for documents. ...
An 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. ...
A specialized markup language using SGML is used to write the electronic version of the Oxford English Dictionary. ...
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. An 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. ...
In computing, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML, based on Murata Makotos RELAX and James Clarks TREX. A RELAX NG schema specifies a pattern for the structure and content of an XML document. ...
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 computing, HyperText Markup Language (HTML) is a markup language designed for the creation of web pages and other information viewable in a browser. ...
XHTML is the new standard for webpage authoring used by l33t programmers. ...
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). A data type is a constraint placed upon the interpretation of data in a type system in computer programming. ...
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. A Document Type Declaration, or DOCTYPE, associates a particular SGML or XML document with a Document Type Definition (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. A public identifier is a document processing construct in SGML. It was subsequently incorporated into XML. In HTML and XML, a public identifier is meant to be universally unique within its application scope. ...
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. ...
Examples Here is an example of a Document Type Declaration containing both public and system identifiers: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Here is an example of a Document Type Declaration that encapsulates an internal subset consisting of a single entity declaration: <!DOCTYPE foo [ <!ENTITY greeting "hello"> ]> <!DOCTYPE bar [ <!ENTITY greeting "hello"> ]> 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 Uniform Resource Identifier (URI), is a compact string of characters used to identify or name a resource. ...
XML DTDs and schema validation The XML DTD syntax is one of several XML schema languages. An 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. ...
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:
<!ELEMENT BR - O EMPTY -- forced line break --> The - after the element name "BR" means a start tag, <BR>, is required and the O after 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 <!ELEMENT br EMPTY> 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 HTML BR element must be written in lowercase in XHTML as defined above (br). - Element declarations in XML cannot exclude other elements. For example, in HTML,
<!ELEMENT FORM - - (%flow;)* -(FORM) -- interactive form --> defines a FORM element that includes certain elements (with an SGML entity) but, due to the -(FORM) part, cannot include other FORMs. In XHTML the FORM is thus defined as <!ELEMENT form %form.content;> which simply includes certain elements.. In computing, HyperText Markup Language (HTML) is a markup language designed for the creation of web pages and other information viewable in a browser. ...
BR or Br may be: 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 BR postal area, a group of eight postal districts in southeast London Bromine (Br), atomic number...
Text sometimes exhibits case sensitivity, that is, words can differ in meaning based on the differing use of uppercase and lowercase letters. ...
An entity is something that has a distinct, separate existence, though it need not be a material existence. ...
XML DTD Example An example of a very simple XML DTD to describe a list of persons is given below: <!ELEMENT people_list (person*)> <!ELEMENT person (name, birthdate?, gender?, socialsecuritynumber?)> <!ELEMENT name (#PCDATA)> <!ELEMENT birthdate (#PCDATA)> <!ELEMENT gender (#PCDATA)> <!ELEMENT socialsecuritynumber (#PCDATA)> Taking this line by line, it says: people_list is a valid element name, and an instance of such an element contains any number of person elements. The * denotes there can be 0 or more person elements within the people_list element. person is a valid element name, and an instance of such an element contains one element named name, followed by one named birthdate (optional), then gender (also optional) and socialsecuritynumber (also optional). The ? indicates that an element is optional. The reference to the name element name has no ?, so a person element must contain a name element. name is a valid element name, and an instance of such an element contains character data. birthdate is a valid element name, and an instance of such an element contains character data. gender is a valid element name, and an instance of such an element contains character data. socialsecuritynumber is 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": <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE people_list SYSTEM "example.dtd"> <people_list> <person> <name>Fred Bloggs</name> <birthdate>27/11/2008</birthdate> <gender>Male</gender> </person> </people_list> 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. Render may refer to: Rendering (computer graphics), generating the pixels of an image based on a high-level description of its components XRender, or Render, an X Window System rendering extension Industrial rendering, the processing of waste animal parts to separate the fat from the bone and protein Kitchen rendering...
An example of a Web browser (Konqueror) A Web browser is a software application that enables a user to display and interact with text, images, and other information typically located on a Web page at a website on the World Wide Web or a local area network. ...
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 starting in 1995. ...
Mozilla was the official, public, original name of Mozilla Application Suite by the Mozilla Foundation, nowadays called SeaMonkey suite. ...
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')
Three newer XML schema languages that are much more powerful are increasingly favored over DTDs: The extended BackusâNaur form (EBNF) is an extension of the basic BackusâNaur form (BNF) metasyntax notation. ...
- 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.
An 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. ...
In computing, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML, based on Murata Makotos RELAX and James Clarks TREX. A RELAX NG schema specifies a pattern for the structure and content of an XML document. ...
Document Schema Definition Languages (DSDL) is a framework within which multiple validation tasks of different types can be applied to an XML document in order to achieve more complete validation results than just the application of a single technology. ...
Document Structure Description, or DSD, is an XML schema language, for describing valid XML documents. ...
See also A Document Type Declaration, or DOCTYPE, associates a particular SGML or XML document with a Document Type Definition (DTD). ...
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 form that can be read and used by software agents, thus permitting them to find, share and integrate information more easily. ...
External links |