Skip to main content

Chapter 03 XML - DTD (Document Type Definition )-Technology369kk

  DTD 

(Document Type Definition)

  • DTD stands for Document Type Definition, and it is a markup language used to define the structure and constraints of an XML (eXtensible Markup Language) document. A DTD defines the elements, attributes, and entity references allowed in an XML document and their relationships.
  • A DTD defines the structure and the legal elements and attributes of an XML document. It checks vocabulary and validity of the structure of XML documents against grammatical rules of appropriate XML language. 

Table of Content: 

XML DTD Introduction:

  • XML Document Type Definition/Declaration.
  • Used to Describes with XML language pre closing 
  • Used to define structure of a xml document 
  • Contains list of legal elements 
  • Used to perform dali-datation.

  • DTD SYNTAX:   

<! DOCTYPE element DTD identifiers
  [Declaration 1
   Declaration 2
  ]>



Types of DTD:  

  1. Internal  : Element as declaration within the XML files.

Syntax:::

<! DOCTYPE root-element
  [Element-Declaration]
>

  1. External : Element as declaration outside the XML files. 

Syntax:::

<! DOCTYPE root-element
  Element-SYSTEM ="file-name";
>


Advantages of DTD: 

Here are some advantages of using DTD:-
  • You can define your own format for the XML files.
  • Looking at this document a user/developer can understand the structure of the data.
  • It helps in validation of XML file.
  • It provides us with proper documentation.
  • It enables us to describe an XML document efficiently

Disadvantages of DTD: 

Some of the disadvantages of DTD are:
  • DTD can be complex and difficult to understand, especially for non-technical users. This can make it challenging to create and maintain DTDs, and may require specialized training or expertise.
  • DTD has some limitations in terms of its functionality and expressiveness.
  • It does not support namespaces.
  • It supports only the text string data type.
  • It is not object-oriented. Hence, the concept of inheritance cannot be applied to DTDs.

Example of DTD: 

Q1. Here is an example of a simple DTD for a bookstore:

<!DOCTYPE student [
    <!ELEMENT student (bca+)>
    <!ELEMENT bca(name, roll, year, regfee)>
    <!ELEMENT name (#SHAILES)>
    <!ELEMENT roll (#82025)>
    <!ELEMENT year (#2020)>
    <!ELEMENT regfee (#3500)>
]>


ANOTHER EXAMPLE: 

<!DOCTYPE bookstore [
    <!ELEMENT bookstore (book+)>
    <!ELEMENT book (title, author, year, price)>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT author (#PCDATA)>
    <!ELEMENT year (#PCDATA)>
    <!ELEMENT price (#PCDATA)>
]>

In this example:

  • The bookstore element is the root element and can contain one or more book elements.
  • The book element contains the elements title, author, year, and price.
  • The title, author, year, and price elements are defined as containing only parsed character data (#PCDATA).
  • This DTD specifies the structure of an XML document representing a bookstore, where each book has a title, author, publication year, and price.

Conclusion :

DTDs can also define attributes for elements, specify the order and occurrence of elements, define entities, and more. However, DTDs have limitations and are considered less expressive and flexible compared to other schema languages like XML Schema or Relax NG.

I hope this is helpful for you.. 




Comments

Popular posts from this blog

Assignment of ITA/ Information Technology and Application BCA- Technology369kk

Q1. What is  computer Explain basic computer architecture and Difference components.  2. Discuss the use of memory in computer system, Explain memory hierarchy  in details. 3. What is software? Explain difference types of software with explain. 4. Write short notes on the given:- (I) Internet. (II) LAN (Local area network ) (III) Search engine (IV) Web browser  Q 1.What is computer Explain basic computer architecture, Difference components of computer.   Computer :- Computer is defined as an electronic device that takes input data and instructions from the user and after processing them, it generates useful and desired output quickly.   A computer is designed to execute applications and provides a variety of solutions through integrated hardware and software components.                            It is fast and automatic device. It works with the help of programs and represents the d...

C++ and Java Practical All Questions Answers - BCA -Technology369kk

C++ and Java  In this post see most important questions for practical questions given by college all questions with answers . Guys I want to say that this is only for suggested post for your practical please request to you change same alphabets, words or anything  methods name and variables name because if you write all words same then this is copy paste for another peoples.  Used Topics:  Keywords, Variables, Condition Statements, Function , Array, Structure, Pointer.                           In OOPs, Class and Objects, Constructor, Poly morph, Encapsulation, Access Specifiers,                               Inheritance etc.  So, Without Time Lose Come to the Points, let's go start Now:        *************************************************************************  C++ 12 ...

Assignment of PMO (Principal of Management and Organization) - Technology369kk

 ** Assignment Of PMO ** Agenda: -  4 Questions discuss in this post. Question 1. Write a d etails note on selection why it Called. negative process.  Question 2. Write a details note on 'span of control. Question 3. Planning is an essential process, do you agree ? Discuss  Question 4. Write a note on management function. Q 1. Write a d etails note on selection why it called negative process.  Ans :-  Selection is the process of choosing the most suitable candidates out of the several candidates available.          Selection is a negative process because there may be more rejected then those selected in most of the candidates that is called selection is a negative process. → Selection process has the following steps:-  [ A .] Screening of applicants - Based on the screening of applicants only those candidates. It Called further process of selection. Who are found eligible for the job Standards of the the organization. [ B .] S...