+91 90691 39140 | +1 253 214 3115 | info@hub4tech.com | hub4tech

DTD Interview Questions and Answers

1
What is DTD?

DTD is abbreviated as Document Type Definition and it is defined to build legal building blocks of an XML document. It defines the XML document structure with elements and attributes.

2
Give the main reasons to use DTD?

Some main reasons to use DTD are given Below:

  • Using DTD XML files can write its description into its format.
  • DTD is an most acceptable standard using DTD different group members can interchange data each other.
  • Also, using DTD we can check the validity of our own data and the data that comes from different groups(other persons).
3
what is Description of DTD

< !DOCTYPE employee : It defines that the root element of the document is employee.
< !ELEMENT employee: It defines that the employee element contains 3 elements "firstname, lastname and email".
< !ELEMENT firstname: It defines that the firstname element is #PCDATA typed. (parse-able data type).
< !ELEMENT lastname: It defines that the lastname element is #PCDATA typed. (parse-able data type).
< !ELEMENT email: It defines that the email element is #PCDATA typed. (parse-able data type).

4
what are XML DTD with entity declaration

A doctype declaration can also define special strings that can be used in the XML file.
An entity has three parts:

  • An ampersand (&)
  • An entity name
  • A semicolon (;)

Syntax to declare entity:

  • < !ENTITY entity-name "entity-value">
    Let's see a code to define the ENTITY in doctype declaration.
    author.xml
  • < ?xml version="1.0" standalone="yes" ?>
  • < !DOCTYPE author [
  • < !ELEMENT author (#PCDATA)>
  • < !ENTITY sj "Sonoo Jaiswal">
  • ]>
  • &sj;
5
what is Purpose of DTD

Its main purpose is to define the structure of an XML document. It contains a list of legal elements and define the structure with the help of them.

Copyright ©2015 Hub4Tech.com, All Rights Reserved. Hub4Tech™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
All trademarks and logos appearing on this website are the property of their respective owners.
FOLLOW US