XML DTD Tutorial

In this xml dtd based tutorial we will study about xml dtd and advantages of dtd. This tutorial also covers the information about features of dtd, structure of dtd, different types of dtd, xml dtd example, internal and external dtd.

What is dtd in xml ?

In xml dtd stands for Document Type Definition. XML dtd is used to express the XML language. XML dtd is generally usd for the following purpose.
  • DTD in XML is used to check the validity of XML.
  • Structure and vocabulary of XML can be checked using xml dtd.
  • XML dtd Checks the grammatical rules of XML language.
DTD contains declaration of following XML components 
  • Element
  • Attributes
  • Entities
Elements are building block of XML document.

Attributes are associated with elements describe its features.

Entities are placeholders in XML which can be declared in the document

xml dtd

Features of xml dtd

Various features of xml dtd are as follow
  • DTD decides the elements which appears in DTD
  • Xml dtd decides the order of appeared elements
  • DTD decides the elements are optional or mandatory

Advantages of xml dtd

Various advantages of using the xml dtd are as follow-
  • Validity checking : It checks the validity of XML file by checking the order of elements and the elements are inserted in correct way.
  • Documentation : One of the major advantage is that you can define your own XML format . various Users can understand the structure by looking over the Document defined

Disadvantages of using the xml dtd

Some disadvantages of using xml dtd are as follow-
  • Text strings data types are supported only.
  • Object – oriented feature is not there in DTD.
  • Namespaces are not supported.

XML dtd syntax

Basic Syntax of declaring the xml document is as follow

  • DTD starts with declaration DOCTYPE 
  • DTD Identifier is used for document type declaration , a DTD can have External Subset also.
  • Various declarations are enclosed in Square Brackets called Internal Subset.
For Internal and External DTD , you have different syntax structure which is explained in next section of this xml dtd tutorial.

Types of xml dtd

Different types of dtd in xml are explained in this section. These types of xml dtd are as follow:-
DTD can be classified on the basis of declaration of XML document  in two ways-

(1) Internal DTD

 If elements of dtd are declared inside the xml file then this type of dtd is referred as internal dtd.
Syntax for Internal dtd in xml.

Syntax for internal dtd is as follow

Where root is the root element of the document and declaration is where you declare the elements.

 An example of xml dtd example for internal dtd is as shown in following figure.

xml dtd example pdf

(2) External DTD 

When dtd elements are declared in external file and this file must be accessed in main XML document in which we are using this dtd. The definition in xml document must contain a reference to this external DTD file.

Syntax for using accessing the external dtd in xml file is as follow

Where file name defines with .dtd extension.

Example for external dtd

An example for xml dtd is given below.

structure of dtd


In this tutorial we discussed about xml document type definition it means xml dtd. We learned about different features of xml dtd, use of xml dtd, its advantages and disadvantages, syntax of xml dtd, how to use internal dtd and external dtd.

I hope this xml dtd tutorial will be helpful to you in understanding the concepts and use of xml dtd.




addressing modes types,1,advance-java,2,aktu entrance exam,1,aktu exam schedule,1,ASP,1,bare machine,1,base register and limit register,1,C Programming,18,C Plus Plus,1,c programming notes for gate,18,C programming Tutorials,8,Cache Memory,1,Childcare,1,CJ,1,Cloud Computing,1,CN,4,Computer Architecture,2,Computer architecture based questions for gate exam,11,Computer architecture Tutorials,1,Computer Network,3,Computer Network Study Material,2,Computer network study material for gate,1,Computer Networks,10,Computer networks gate questions with answer,3,computer networks notes,1,computer networks tutorial,1,Computer Science Study Material for Gate,13,computer science study material for gate exam,17,contiguous memory allocation,2,Core Java,3,cyber crime report,1,Cyber crime status,1,cybercrime and security,1,cybercrime examples,1,data communications and networking,1,Data Structure,2,Data Structure Questions,1,Data Transmission Architecture,1,Data Transmission in wsn,1,database normalization,1,dbmas study material,1,DBMS,8,dbms gate questions with answer,1,dbms multiple choice questions with answers for gate,1,dbms question paper,1,DE,1,Digital Electronics,1,DS,4,Electroencephalogram,1,ER diagram Tutorial,1,Gate 2017,3,Gate 2017 Admit card,1,GATE 2020,1,gate cse c programming questions,10,gate cse study material,2,gate cse syllabus,2,gate practice set,7,gate questions on c programming,10,gate study material for computer science,14,Gate study material for computer science 2017,1,gate study material for cse,46,General,3,HCL Aptitude Test,1,HR Interview Questions,1,HTML,4,Important Date of Gate 2017 Exam,1,Information Security Policy,1,internal and external fragmentation,1,Java Tutorials,3,JDBC,2,JDBC Tutorial,1,JS,1,memory fragmentation,1,memory management,1,memory management questions and answer in os,1,Motivational,4,NCER,1,Numerical Techniques Lab,1,OOT,1,Operating System,6,Operating System Gate Questions,2,Operating System Objective Questions,4,Operating System Questions Bank,1,operating system study material for gate exam,11,operating system tutorial notes,8,Operating System tutorials resident monitor,1,page swapping,1,paged memory allocation,1,paged memory allocation in operating system,1,Regression testing,1,relocation register,1,routing table,1,Software Engineering,10,Software Engineering baes study material for gate,1,Software Quality Assurance,3,software verification methods,1,Stack,1,Study Material for gate Computer Science,5,swapping in memory management,1,swapping in operating system,1,TCS Code Vita,1,TCS Interview Questions,1,Technical Interview,1,Technical Questions from DBMS,1,Tips to Learn Coding,1,UML,1,Virtualization,1,What is process control block ?,1,what is software testing?,1,Wireless Sensor Network,3,worst fit algorithm for memory allocation,1,XML,2,
Computer Science Junction: XML DTD Tutorial
XML DTD Tutorial
In this xml dtd based tutorial we will study about xml dtd and advantages of dtd. This tutorial also covers the information about features of dtd, structure of dtd, different types of dtd, xml dtd example, internal and external dtd.
Computer Science Junction
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share. STEP 2: Click the link you shared to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy