XML Language / Document Type Definition (DTD)

Document Type Definition (DTD)
It tells about the structure (root, containers, sub containers and elements) and their data types of an XML document. i.e DTD is used to verify that XML data is valid or not. It is used for exchanging data with a people who agrees on DTD standard.

DTD Data Types
Data Types Details
CDATA character data
ENTITY Entity value
ENTITIES Entities value
ID unique id
IDREF Id of another element
IDREFS Id’s of another element
NMTOKEN valid XML name value
NMTOKENS valid XML names value
PCDATA Parsed Character Data

DTD Data Types
1. Internal.          2. External.

Internal DTD Declaration
If the DTD is declared inside the XML file it is called internal DTD.

Internal DTD (save file with .xml extension. I.e IDTD.xml)
Internal DTD

Internal DTD

Explanation
Element Define
!DOCTYPE languages Root
!ELEMENT languages languages
!ELEMENT textbookAuthornames Container
!ELEMENT c Sub Container
!ELEMENT Authorname Element
!ELEMENT cpp Sub Container


External DTD (save file with .xml extension. I.e EDTD.xml)
If the DTD is declared in an external file and reference to the DTD file is given xml then it is called as External DTD.
External DTD
External DTD output


Home     Back