Document Type Definition

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email
The Document Type Definition (DTD) acts as a set of rules based upon which new documents of the same type can be created. Suppose, for example a DTD was created for use in libraries. Documents created with this DTD may contain items such as the name of the book, author of the book, etc,. This document will provide a standardised document for all libraries.

DTD Structure

A DTD consists of two parts, an external DTD sub set and an internal DTD sub set. An external DTD sub set is a DTD that exists outside the content of the document. An internal DTD subset is one which is included in the XML document itself. An XML document can contain both, but the internal sub set is the first one to be processed.

Creating a Simple DTD

Before exploring the details of the DTD we shall create a simple DTD. The following codes represent a DTD for a library information system: <?xml version="1.0"?>
<!DOCTYPE LIB [
<!ELEMENT LIB(TITLE, AUTHOR, ISBN, PUBLISHER)>
<!ELEMENT TITLE(#PCDATA)>
<!ELEMENT AUTHOR(#PCDATA)>
<!ELEMENT ISBN(#PCDATA)>
<!ELEMENT PUBLISHER(#PCDATA)>
]> <LIB>
<TITLE>mybook</TITLE>
<AUTHOR>myself</AUTHOR>
<ISBN>000-000-000</ISBN>
<PUBLISHER>the nobody's press</PUBLISHER>
</LIB>

The above code is an example of an internal DTD subset. It identifies the elements that are allowed in the document and the type of data that they can contain.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.