{"id":68,"date":"2018-07-26T06:10:46","date_gmt":"2018-07-26T06:10:46","guid":{"rendered":"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=68"},"modified":"2022-01-06T12:03:57","modified_gmt":"2022-01-06T12:03:57","slug":"xmldtd","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/chapter\/xmldtd\/","title":{"rendered":"XMLDTD"},"content":{"raw":"<div>\r\n\r\n<strong>\u00a0 \u00a0 \u00a0Document Type Definitions<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes about Elements, Attributes and Entities defined in an XML document. An XML document is called a well-structured XML document if it follows certain simple syntactic rules and an XML document is called a valid XML document if it also specifies and conforms to a DTD.<\/p>\r\n&nbsp;\r\n\r\n<strong>The need for DTDs<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">XML documents are designed to be processed by computer programs and if we can put just <em>any<\/em> tags in an XML document, it\u2019s very hard to write a program that knows how to process the tags. A DTD specifies what tags may occur, when they may occur, and what attributes they may or must have. A DTD allows the XML document to be verified (shown to be legal) by the browser. A DTD that is shared across groups allows the groups to produce consistent XML documents.<\/p>\r\n\r\n<\/div>\r\n<strong style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 An XML example<\/strong>\r\n<div>\r\n\r\n&nbsp;\r\n\r\nFollowing is an simple example of an XML document.\r\n\r\n&lt;nove l&gt;\r\n\r\n&lt;foreword&gt;\r\n\r\n&lt;paragraph&gt;This is the great Indian novel.&lt;\/ paragraph&gt; &lt;\/foreword&gt;\r\n\r\n&lt;chapter number=\"1\"&gt;\r\n\r\n&lt;paragraph&gt;It was a dark and stormy night.&lt;\/paragraph&gt; &lt;paragraph&gt;Suddenly, a shot rang out!\u00a0 \u00a0 \u00a0 &lt;\/paragraph&gt;\r\n\r\n&lt;\/chapter&gt;\r\n\r\n&lt;\/novel&gt;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">This XML document contains elements and attributes and the DTD describes about the elements, such as &lt;novel&gt;, &lt;foreword&gt;, &lt;chapter&gt; and &lt;paragraph&gt;, consisting of <em>tags<\/em> and <em>content<\/em>. The element &lt;novel&gt; consists of elements &lt;foreword&gt; and &lt;chapter&gt;. The element &lt;chapter&gt; consists of attributes, such as number=\"1\", consisting of a <em>name<\/em> and a <em>value.<\/em><\/p>\r\nThis XML file is described with the following DTD,\r\n\r\n&nbsp;\r\n\r\n<strong>A DTD example<\/strong>\r\n\r\n&nbsp;\r\n\r\n&lt;!DOCTYPE novel [\r\n\r\n&lt;!ELEMENT novel (foreword, chapter+)&gt;\r\n\r\n&lt;!ELEMENT foreword (paragraph+)&gt;\r\n\r\n&lt;!ELEMENT chapter (paragraph+)&gt;\r\n\r\n&lt;!ELEMENT paragraph (#PCDATA)&gt;\r\n\r\n&lt;!ATTLIST chapter number CDATA #REQUIRED&gt;\r\n\r\n]&gt;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The DTD of an XML document starts with &lt;!DOCTYPE root-element [ \u2026]&gt; In this example we have defined as,<\/p>\r\n&lt;!DOCTYPE novel [ \u2026]&gt;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">In an DTD the elements are described as&lt;!ELEMENT\u2026&gt; and attributes of the element are described as<\/p>\r\n&lt;!ATTLIST \u2026.&gt;.\r\n\r\n&nbsp;\r\n\r\nHere in this example, a novel consists of a foreword and one or more chapters, in that order. A foreword consists of one or more paragraphs. A chapter also consists of one or more paragraphs. A paragraph consists of parsed character data which means the text that cannot contain any other elements.\r\n\r\n&nbsp;\r\n\r\nEach chapter must have a number attribute given as \u201cREQUIRED\u201d.\r\n\r\n<\/div>\r\n<strong style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0ELEMENT descriptions<\/strong>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">An element content can be another element or a list of child elements or it can be a text string or numeric value (character data).<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">There are suffixes added to the element content where an element consists of zero, one or more occurences of the child elements. A (?) specifies optional or zero, (+) denotes one or more elements can occur and a (*) denotes zero or more of the elements can occur.<\/p>\r\n\r\n<table class=\"aligncenter\" style=\"border-collapse: collapse; width: 90.8869%; height: 88px;\" border=\"1\">\r\n<tbody>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 33.3333%; height: 14px;\">?<\/td>\r\n<td style=\"width: 33.3333%; height: 14px;\">optional<\/td>\r\n<td style=\"width: 33.3333%;\">foreword?<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 33.3333%; height: 14px;\">+<\/td>\r\n<td style=\"width: 33.3333%; height: 14px;\">one or more<\/td>\r\n<td style=\"width: 33.3333%;\">chapter+<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 33.3333%; height: 14px;\">*<\/td>\r\n<td style=\"width: 33.3333%; height: 14px;\">zero or more<\/td>\r\n<td style=\"width: 33.3333%;\">appendix*<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p style=\"text-align: justify;\">Seperators can also be added with the element declaration, that specifies the order of occurrence when the element has multiple number of child elements. There are two ways we can use to denote the order of occurrence. Using a comma (,) between the child elements specifies that the child elements will occur in the order given. Using a vertical line (|) means that either one or the other child element will occur.<\/p>\r\n<p style=\"text-align: center;\"><\/p>\r\n\r\n<\/div>\r\n<div>\r\n<table class=\"aligncenter\" style=\"border-collapse: collapse; width: 87.9782%; height: 64px;\" border=\"1\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 33.3333%;\">,<\/td>\r\n<td style=\"width: 33.3333%;\">both, in order<\/td>\r\n<td style=\"width: 33.3333%;\">foreword?, chapter+<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 33.3333%;\">|<\/td>\r\n<td style=\"width: 33.3333%;\">or<\/td>\r\n<td style=\"width: 33.3333%;\">section|chapter<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<strong>Grouping:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The elements can be grouped in the element content with parenthesis which can also be specified along with the order of occurrence or the number of occurrences of the child elements.<\/p>\r\n( ) grouping (section|chapter)+\r\n\r\n&nbsp;\r\n\r\n<strong>Elements without children<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Elements can be defined as empty or without children.<\/p>\r\n<p style=\"text-align: justify;\">&lt;!ELEMENT name category&gt;<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The <em>name<\/em> is the element name used in start and end tags and the <em>category<\/em> may be given as EMPTY. In the DTD the &lt;br&gt; tag can be defined as : &lt;!ELEMENT br EMPTY&gt; In the XML the tag can be used as: &lt;br&gt;&lt;\/br&gt; or just &lt;br \/&gt;<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">In the XML, an empty element may not have any content between the start tag and the end tag but an empty element may (and usually does) have attributes.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<strong>\u00a0<\/strong>\r\n\r\n<strong> Elements with unstructured children<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe elements can be defined with unstructured children.\r\n\r\n&lt;!ELEMENT name category&gt;\r\n\r\nHere the category may be ANY.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">This indicates that <em>any<\/em> content character data, elements, even undeclared elements may be used. Since the whole point of using a DTD is to define the structure of a document, ANY should be avoided wherever possible.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The category may be (#PCDATA), indicating that only character data may be used. Here the parentheses are required.<\/p>\r\n&nbsp;\r\n\r\nIn the DTD when an element is defined as (#PCDATA), the syntax is given as,\r\n\r\n&lt;!ELEMENT paragraph (#PCDATA)&gt;\r\n\r\n&nbsp;\r\n\r\nIn the XML file the element can contain text content\r\n\r\n&lt;paragraph&gt;A shot rang out!&lt;\/paragraph&gt;\r\n<p style=\"text-align: justify;\"><em>Note:<\/em> In (#PCDATA), whitespace is kept exactly as entered. Elements may<em> not <\/em>be used within parsed character data. Entities are character data, and <em>may<\/em> be used.<\/p>\r\n&nbsp;\r\n\r\n<strong>Elements with children<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">An element can contain one or more children.<\/p>\r\n<p style=\"text-align: justify;\">A category may describe one or more children as given in the syntax below,<\/p>\r\n<p style=\"text-align: justify;\">&lt;!ELEMENT novel (foreword, chapter+)&gt;<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Here the parentheses are required, even if there is only one child, a space must precede the opening parenthesis. Commas (,) between elements mean that <em>all<\/em> children must appear, and must be <em>in the<\/em> <em>order specified<\/em>. The \u201c|\u201d separators means any one child may be used. All child elements must themselves be declared. Children may have children and parentheses can be used for grouping.<\/p>\r\n&nbsp;\r\n\r\nAn complete example of the syntax we have seen so far is given in the following example .\r\n\r\n&lt;!ELEMENT novel (foreword, (chapter+|section+))&gt;\r\n\r\n<\/div>\r\n<strong style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 \u00a0Elements with mixed content<\/strong>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Elements can also contain mixed content with text data or elements or both.Here #PCDATA describes elements with only character data and #PCDATA can be used in an \u201cor\u201d grouping also as follows,<\/p>\r\n&nbsp;\r\n\r\n&lt;!ELEMENT note (#PCDATA|message)*&gt;\r\n\r\nThis is called a mixed content\r\n\r\n&nbsp;\r\n\r\nBut certain and rather severe restrictions apply:\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0 #PCDATA must be first\r\n\r\n\u2022\u00a0 The separators must be \u201c|\u201d\r\n\r\n\u2022\u00a0 \u00a0The group must be starred (meaning zero or more)\r\n\r\n&nbsp;\r\n\r\n<strong>Names and namespaces<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">All names of elements, attributes, and entities, in both the DTD and the XML, are formed by following the rules given as below,<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">\u2022 The name must begin with a letter or underscore.<\/p>\r\n<p style=\"text-align: justify;\">\u2022 The name may contain only letters, digits, dots, hyphens, underscores, and colons (and, for foreign languages, combining characters and extenders).<\/p>\r\n&nbsp;\r\n\r\nThe DTD doesn\u2019t know about namespaces as far as it knows, a colon is just part of a name\r\n\r\nThe following are different (and both legal),\r\n\r\n&lt;!ELEMENT chapter (paragraph+)&gt;\r\n\r\n&lt;!ELEMENT myBook:chapter (myBook:paragraph+)&gt;\r\n\r\nWe need to avoid colons in names, except to indicate namespaces.\r\n\r\n&nbsp;\r\n\r\n<strong>An expanded DTD example<\/strong>\r\n\r\n&nbsp;\r\n\r\nAn example covering all those concepts we have seen so far is given now.\r\n\r\n&lt;!DOCTYPE novel [\r\n\r\n&lt;!ELEMENT novel\r\n\r\n(foreword, chapter+, biography?, criticalEssay*)&gt; &lt;!ELEMENT foreword (paragraph+)&gt; &lt;!ELEMENT chapter (section+|paragraph+)&gt; &lt;!ELEMENT section (paragraph+)&gt; &lt;!ELEMENT biography(paragraph+)&gt;\r\n\r\n&lt;!ELEMENT criticalEssay (section+)&gt;\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;!ELEMENT paragraph (#PCDATA)&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">]&gt;<\/span>\r\n\r\n<\/div>\r\n<div>\r\n<p style=\"text-align: justify;\">\u00a0 \u00a0 \u00a0 The root element is the &lt;novel&gt; element. It consists of elements such as &lt;foreword&gt;, one or more &lt;chapter&gt; elements, zero or one &lt;biography&gt; elements and zero or more &lt;criticalEssay&gt; elements. The &lt;foreword&gt; elements consists of one or more &lt;paragraph&gt; elements. The &lt;chapter&gt; elements consists of one or more &lt;section&gt; or &lt;paragraph&gt; elements.The &lt;section&gt; element consists of one or more &lt;paragraph&gt; elements. The element &lt;biography&gt; consists of one or more &lt;paragraph&gt; elements. The element &lt;criticalEssay&gt; consists of one or more &lt;section&gt; elements. The element &lt;paragraph&gt; consists of #PCDATA.<\/p>\r\n&nbsp;\r\n\r\n<strong>Attributes and entities<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">In addition to elements, a DTD may declare attributes and entities. An attribute describes information that can be put within the start tag of an element.<\/p>\r\n&nbsp;\r\n\r\nIn the XML file we define the attributes as follows,\r\n\r\n&lt;dog name=\"Spot\" age=\"3\"&gt;&lt;\/dog&gt;\r\n\r\n&nbsp;\r\n\r\nIn an DTD file the attribute is described as,\r\n\r\n&lt;!ATTLIST dog\r\n\r\nname\u00a0 CDATA\u00a0 #REQUIRED\r\n\r\nage\u00a0\u00a0\u00a0\u00a0\u00a0 CDATA\u00a0 #IMPLIED &gt;\r\n\r\n&nbsp;\r\n\r\nAn entity describes text to be substituted.\r\n\r\nIn an XML file an entity is defined as,\r\n\r\n&amp;copyright;\r\n\r\n&nbsp;\r\n\r\nIn the DTD it is described as,\r\n\r\n&lt;!ENTITY copyright \"Copyright Dr. Dave\"&gt;\r\n\r\n&nbsp;\r\n\r\n<strong>Attributes<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe format of defining an attribute is,\r\n\r\n&lt;!ATTLIST <em>element-name<\/em>\r\n\r\n<em>name\u00a0 type\u00a0 requirement<\/em>\r\n\r\n<em>name\u00a0 type\u00a0 requirement<\/em>&gt;\r\n\r\nwhere the <em>name-type-requirement<\/em> may be repeated as many times as desired.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Note that only spaces separate the parts, so careful counting is essential. The <em>element-name<\/em> tells which element may have these attributes.<span style=\"text-align: initial; font-size: 1em;\">The <\/span><em style=\"text-align: initial; font-size: 1em;\">name<\/em><span style=\"text-align: initial; font-size: 1em;\"> is the name of the attribute. Each element has a <\/span><em style=\"text-align: initial; font-size: 1em;\">type<\/em><span style=\"text-align: initial; font-size: 1em;\">, such as CDATA (character data).<\/span><span style=\"text-align: initial; font-size: 1em;\">The <\/span><em style=\"text-align: initial; font-size: 1em;\">requirement<\/em><span style=\"text-align: initial; font-size: 1em;\"> may be defined as required, optional, or \u201cfixed\u201d. In the XML, attributes may occur in any order<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<strong>\u00a0<\/strong>\r\n\r\n<strong> Important attribute types<\/strong>\r\n\r\n&nbsp;\r\n\r\nThere are ten attribute types and these are the most important ones:\r\n\r\n<\/div>\r\n<table class=\"alignright\" style=\"border-collapse: collapse; width: 96.3592%; height: 157px;\" border=\"1\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 26%;\">CDATA<\/td>\r\n<td style=\"width: 74%;\">The value is character data<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 26%;\">(man|woman|child)<\/td>\r\n<td style=\"width: 74%;\">The value is one from this list<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 26%;\">ID<\/td>\r\n<td style=\"width: 74%;\">The value is a unique identifier. Note: ID values\r\nmust be legal XML names and must be unique within the\r\ndocument<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 26%;\">NMTOKEN<\/td>\r\n<td style=\"width: 74%;\">The value is a legal XML name. This is sometimes\r\nused to disallow whitespace in the name. It also disallows\r\nnumbers, since an XML name cannot begin with a digit.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 Less important attribute types,<\/strong>\r\n\r\n<\/div>\r\n<div>\r\n<table class=\"aligncenter\" style=\"border-collapse: collapse; width: 91.992%; height: 126px;\" border=\"1\">\r\n<tbody>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 22.9585%; height: 14px;\">IDREF<\/td>\r\n<td style=\"width: 77.0415%; height: 14px;\">The ID of another element<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 22.9585%; height: 14px;\">IDREFS<\/td>\r\n<td style=\"width: 77.0415%; height: 14px;\">A list of other IDs<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 22.9585%; height: 14px;\">NMTOKENS<\/td>\r\n<td style=\"width: 77.0415%; height: 14px;\">A list of valid XML names<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 22.9585%; height: 14px;\">ENTITY<\/td>\r\n<td style=\"width: 77.0415%; height: 14px;\">An entity<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 22.9585%; height: 14px;\">ENTITIES<\/td>\r\n<td style=\"width: 77.0415%; height: 14px;\">A list of entities<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 22.9585%; height: 14px;\">NOTATION<\/td>\r\n<td style=\"width: 77.0415%; height: 14px;\">A notation<\/td>\r\n<\/tr>\r\n<tr style=\"height: 42px;\">\r\n<td style=\"width: 22.9585%; height: 42px;\">xml:<\/td>\r\n<td style=\"width: 77.0415%; height: 42px;\">A predefined XML value<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<strong>Requirements<\/strong>\r\n\r\n&nbsp;\r\n\r\nRecall that an attribute has the form,\r\n\r\n&lt;!ATTLIST <em>element-name name\u00a0 type\u00a0 requirement<\/em>&gt;\r\n\r\nThe <em>requirement<\/em> is one of a default value, enclosed in quotes,\r\n\r\nExample: &lt;!ATTLIST degree CDATA \"PhD\"&gt;\r\n\r\nThe <em>requirement<\/em> can take different values such as #REQUIRED or #IMPLIED or #FIXED.\r\n\r\n<\/div>\r\n<span style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 \u00a0\u2022\u00a0 \u00a0#REQUIRED means the attribute must be present.<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">\u00a0\u2022\u00a0 \u00a0#IMPLIED means the attribute is optional.<\/span>\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">\u00a0\u2022\u00a0 #FIXED \"value\" the attribute always has the given value. If specified in the XML, the same value must be used.<\/span><\/p>\r\n\r\n<div>\r\n\r\n<strong>\u00a0 <\/strong>\r\n\r\n<strong>Entities<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Entities are Variables used to define shortcuts to common text. Entities should not be confused with character references, which are numerical values between &amp; and #.There are exactly five predefined entities: &amp;lt;, &amp;gt;, &amp;amp;, &amp;quot;, and &amp;apos;.Additional entities can be defined in the DTD by the following syntax,<\/p>\r\n<p style=\"text-align: justify;\">&lt;!ENTITY copyright \"Copyright Dr. Dave\"&gt;<\/p>\r\n<p style=\"text-align: justify;\">Entities can be defined in another document by,<\/p>\r\n<p style=\"text-align: justify;\">&lt;!ENTITY copyright SYSTEM \"MyURI\"&gt;<\/p>\r\n<p style=\"text-align: justify;\">An example of use in the XML as,<\/p>\r\n<p style=\"text-align: justify;\"><em>This document is &amp;copyright; 2002.<\/em><\/p>\r\n&nbsp;\r\n\r\n<strong>Another example: XML<\/strong>\r\n\r\n&nbsp;\r\n\r\n&lt;?xml version=\"1.0\"?&gt;\r\n\r\n&lt;!DOCTYPE weatherReport SYST EM \"http:\/\/www.mysite.com\/mydoc.dtd\"&gt; &lt;weatherReport&gt;\r\n\r\n&lt;date&gt;05\/29\/2002&lt;\/date&gt;\r\n\r\n&lt;location&gt;\r\n\r\n&lt;city&gt;Chennai&lt;\/city&gt; &lt;state&gt;Tamilnadu&lt;\/state&gt; &lt;country&gt;INDIA&lt;\/country&gt;\r\n\r\n&lt;\/location&gt;\r\n\r\n&lt;temperature -range&gt;\r\n\r\n&lt;high scale=\"F\"&gt;84&lt;\/high&gt;\r\n\r\n&lt;low scale=\"F\"&gt;51&lt;\/low&gt;\r\n\r\n&lt;\/temperature -range&gt;\r\n\r\n&lt;\/weatherReport&gt;\r\n\r\n&nbsp;\r\n\r\n<strong>The DTD for this example<\/strong>\r\n\r\n&nbsp;\r\n\r\n&lt;!ELEMENT weatherReport (date, location, temperature -range)&gt;\r\n\r\n&lt;!ELEMENT date (#PCDATA)&gt;\r\n\r\n&lt;!ELEMENT location (city, state, country)&gt;\r\n\r\n&lt;!ELEMENT city (#PCDATA)&gt;\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;!ELEMENT state (#PCDATA)&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;!ELEMENT country (#PCDATA)&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;!ELEMENT temperature -range ((low, high)|(high, low))&gt; &lt;!ELEMENT low (#PCDATA)&gt; &lt;!ELEMENT high (#PCDATA)&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;!ATTLIST low scale (C|F) #REQUIRED&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;!ATTLIST high scale (C|F) #REQUIRED&gt;<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<strong>\u00a0 \u00a0<\/strong>\r\n\r\n<strong>Inline DTDs<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">If a DTD is used only by a single XML document, it can be put directly in that document. An inline DTD can be used only by the document in which it occurs.<\/p>\r\n&nbsp;\r\n\r\n&lt;?xml version=\"1.0\"&gt;\r\n\r\n&lt;!DOCTYPE myRootElement [\r\n\r\n&lt;!-- DTD content goes here --&gt;\r\n\r\n]&gt;\r\n\r\n&lt;myRootElement&gt;\r\n\r\n&lt;!-- XML content goes here --&gt;\r\n\r\n&lt;\/myRootElement&gt;\r\n\r\n&nbsp;\r\n\r\n<strong>Inline DTDs - Example<\/strong>\r\n\r\n<\/div>\r\n<span style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 &lt;!DOCTYPE company [<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT company<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT person<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT ssn<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT name<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT office<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT phone<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT product<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT pi d<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT description<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( (person | product)*) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( ssn, name, office, phone?) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( pi d, name, description? ) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">]&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;company&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;person&gt; &lt;ssn&gt; 12345678 &lt; \/ssn&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;name&gt; John &lt;\/name&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;office&gt; B432 &lt;\/office&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;phone&gt; 1234 &lt;\/phone&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;\/person&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;product&gt; \u2026 &lt;\/product&gt;<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">\u2026<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">&lt;\/company&gt;<\/span>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>External DTDs<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">An external DTD which is a DTD defined as a separate document is declared with a SYSTEM or a PUBLIC command. The syntax is given as follows,<span style=\"text-align: initial; font-size: 1em;\">&lt;!DOCTYPE myRootElement SYSTEM \"http:\/\/www.mysite.com\/mydoc.dtd\"&gt;<\/span><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">The name that appears after DOCTYPE (in this example, myRootElement) must match the name of the XML document\u2019s root element. We will use SYSTEM for external DTDs that we define for ourself and we will use PUBLIC for official and published DTD's. External DTDs can only be referenced with a URL.<\/span><\/p>\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">The file extension for an external DTD is .dtd.<\/span><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">External DTD's are almost always preferable to inline DTD's, since they can be used by more than one document.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<strong>\u00a0 <\/strong>\r\n\r\n<strong>\u00a0External DTDs - Example<\/strong>\r\n\r\n&nbsp;\r\n\r\n&lt;!DOCTYPE company SYSTEM \u201ccom pany.dtd\u201d&gt;\r\n\r\n&lt;company&gt;\r\n\r\n&lt;person&gt; &lt;ssn&gt; 12345678 &lt; \/ssn&gt;\r\n\r\n&lt;name&gt; John &lt;\/name&gt;\r\n\r\n&lt;office&gt; B432 &lt;\/office&gt;\r\n\r\n&lt;phone&gt; 1234 &lt;\/phone&gt;\r\n\r\n&lt;\/person&gt;\r\n\r\n&lt;product&gt; \u2026 &lt;\/product&gt;\r\n\r\n\u2026\r\n\r\n&lt;\/company&gt;\r\n\r\n&nbsp;\r\n\r\nIn this example the DTD is defined in a separate document called \u201ccompany.dtd\u201d and referred in the\r\n\r\nXML document after DOCTYPE.\r\n\r\nThe DTD can reside at a different URL, and then we refer to it as,\r\n\r\n&lt;!DOCTYPE company SYSTEM \u201chttp:\/\/www.mydtd.com\/com pany.dtd\u201d&gt;\r\n\r\nAn example of <strong>TV Schedule DTD<\/strong> is given,\r\n\r\n&lt;!DOCTYPE TVSCHEDULE [\r\n\r\n&lt;!ELEMENT TVSCHEDULE (CHANNEL+)&gt;\r\n\r\n&lt;!ELEMENT CHANNEL (BANNER, DAY+)&gt;\r\n\r\n&lt;!ELEMENT BANNER (#PCDATA)&gt;\r\n\r\n&lt;!ELEMENT DAY ((DAT E, HOLIDAY) | (DAT E, PROGRAMSLOT+))+&gt; &lt;!ELEMENT HOLIDAY (#PCDATA)&gt;\u00a0 \u00a0 \u00a0 &lt;!ELEMENT DAT E (#PCDATA)&gt;\r\n\r\n&lt;!ELEMENT PROGRAMSLOT (TIME, TITLE, DESCRIPTION?)&gt; &lt;!ELEMENT TIME (#PCDATA)&gt; &lt;!ELEMENT TITLE (#PCDATA)&gt;\r\n\r\n&lt;!ELEMENT DESCRIPTION (#PCDATA)&gt;\r\n\r\n&lt;!ATTLIST TVSCHEDULE NAME CDATA #REQUIRED&gt; &lt;!ATTLIST CHANNEL CHAN CDATA #REQUIRED&gt; &lt;!ATTLIST PROGRAMSLOT VTR CDATA #IMPLIED&gt; &lt;!ATTLIST TITLE RATING CDATA #IMPLIED&gt; &lt;!ATTLIST TITLE LANGUAGE CDATA #IMPLIED&gt;\r\n\r\n]&gt;\r\n\r\n<\/div>\r\nAnother Example for <strong>Newspaper Article DTD<\/strong> is also given for understanding,\r\n\r\n&lt;!DOCTYPE NEWSPAPER [\r\n\r\n&lt;!ELEMENT NEWSPAPER (ARTICLE+)&gt;\r\n\r\n&lt;!ELEMENT ARTICLE (HEADLINE, BYLINE, LEAD, BODY, NOT ES)&gt; &lt;!ELEMENT HEADLINE (#PCDATA)&gt;\u00a0 \u00a0 \u00a0 &lt;!ELEMENT BYLINE (#PCDATA)&gt;\r\n\r\n&lt;!ELEMENT LEAD (#PCDATA)&gt;\r\n\r\n&lt;!ELEMENT BODY (#PCDATA)&gt;\r\n\r\n&lt;!ELEMENT NOT ES (#PCDATA)&gt;\r\n\r\n&lt;!ATTLIST ARTICLE AUTHOR CDATA #REQUIRED&gt; &lt;!ATTLIST ARTICLE EDITOR CDATA #IMPLIED&gt; &lt;!ATTLIST ARTICLE DAT E CDATA #IMPLIED&gt; &lt;!ATTLIST ARTICLE EDITION CDATA #IMPLIED&gt; &lt;!ENTITY NEWSPAPER \"Vervet Logic Times\"&gt; &lt;!ENTITY PUBLISHER \"Vervet Logic Press\"&gt;\r\n\r\n&lt;!ENTITY COPYRIGHT \"Copyright 1998 Vervet Logic Press\"&gt; ]&gt;\r\n\r\n&nbsp;\r\n\r\n<strong>Limitations of DTDs<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">DTDs are a very weak specification language and we can\u2019t put any restrictions on element contents. It is difficult to specify when all the children must occur, but may be in any order or this element must occur a certain number of times. There are only ten data types for attribute values.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">But most of all DTDs aren\u2019t written in XML. If we want to do any validation,we need one parser for the XML <em>and<\/em> another for the DTD. This makes XML parsing harder than it needs to be. In order to support this, there is a newer and more powerful technology called XML Schemas. However, DTDs are still very much in use.<\/p>\r\n&nbsp;\r\n\r\n<strong>Summary<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">This module provides knowledge about XML DTD.The module identifies the purpose of DTD with few examples. The module also discusses about Inline and External D<\/p>\r\n&nbsp;\r\n\r\n<strong>Web Links<\/strong>\r\n<ul>\r\n \t<li><em>www.w3schools.com\/<strong>xml<\/strong><\/em><\/li>\r\n \t<li><em>www.cis.upenn.edu\/~matuszek\/cit597-2003\/Lectures\/08-<strong>dtd<\/strong>.<strong>ppt<\/strong><\/em><\/li>\r\n \t<li><em>www.tutorialspoint.com\/<strong>xml<\/strong><\/em><\/li>\r\n<\/ul>","rendered":"<div>\n<p><strong>\u00a0 \u00a0 \u00a0Document Type Definitions<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes about Elements, Attributes and Entities defined in an XML document. An XML document is called a well-structured XML document if it follows certain simple syntactic rules and an XML document is called a valid XML document if it also specifies and conforms to a DTD.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>The need for DTDs<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">XML documents are designed to be processed by computer programs and if we can put just <em>any<\/em> tags in an XML document, it\u2019s very hard to write a program that knows how to process the tags. A DTD specifies what tags may occur, when they may occur, and what attributes they may or must have. A DTD allows the XML document to be verified (shown to be legal) by the browser. A DTD that is shared across groups allows the groups to produce consistent XML documents.<\/p>\n<\/div>\n<p><strong style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 An XML example<\/strong><\/p>\n<div>\n<p>&nbsp;<\/p>\n<p>Following is an simple example of an XML document.<\/p>\n<p>&lt;nove l&gt;<\/p>\n<p>&lt;foreword&gt;<\/p>\n<p>&lt;paragraph&gt;This is the great Indian novel.&lt;\/ paragraph&gt; &lt;\/foreword&gt;<\/p>\n<p>&lt;chapter number=&#8221;1&#8243;&gt;<\/p>\n<p>&lt;paragraph&gt;It was a dark and stormy night.&lt;\/paragraph&gt; &lt;paragraph&gt;Suddenly, a shot rang out!\u00a0 \u00a0 \u00a0 &lt;\/paragraph&gt;<\/p>\n<p>&lt;\/chapter&gt;<\/p>\n<p>&lt;\/novel&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">This XML document contains elements and attributes and the DTD describes about the elements, such as &lt;novel&gt;, &lt;foreword&gt;, &lt;chapter&gt; and &lt;paragraph&gt;, consisting of <em>tags<\/em> and <em>content<\/em>. The element &lt;novel&gt; consists of elements &lt;foreword&gt; and &lt;chapter&gt;. The element &lt;chapter&gt; consists of attributes, such as number=&#8221;1&#8243;, consisting of a <em>name<\/em> and a <em>value.<\/em><\/p>\n<p>This XML file is described with the following DTD,<\/p>\n<p>&nbsp;<\/p>\n<p><strong>A DTD example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;!DOCTYPE novel [<\/p>\n<p>&lt;!ELEMENT novel (foreword, chapter+)&gt;<\/p>\n<p>&lt;!ELEMENT foreword (paragraph+)&gt;<\/p>\n<p>&lt;!ELEMENT chapter (paragraph+)&gt;<\/p>\n<p>&lt;!ELEMENT paragraph (#PCDATA)&gt;<\/p>\n<p>&lt;!ATTLIST chapter number CDATA #REQUIRED&gt;<\/p>\n<p>]&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The DTD of an XML document starts with &lt;!DOCTYPE root-element [ \u2026]&gt; In this example we have defined as,<\/p>\n<p>&lt;!DOCTYPE novel [ \u2026]&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">In an DTD the elements are described as&lt;!ELEMENT\u2026&gt; and attributes of the element are described as<\/p>\n<p>&lt;!ATTLIST \u2026.&gt;.<\/p>\n<p>&nbsp;<\/p>\n<p>Here in this example, a novel consists of a foreword and one or more chapters, in that order. A foreword consists of one or more paragraphs. A chapter also consists of one or more paragraphs. A paragraph consists of parsed character data which means the text that cannot contain any other elements.<\/p>\n<p>&nbsp;<\/p>\n<p>Each chapter must have a number attribute given as \u201cREQUIRED\u201d.<\/p>\n<\/div>\n<p><strong style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0ELEMENT descriptions<\/strong><\/p>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">An element content can be another element or a list of child elements or it can be a text string or numeric value (character data).<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">There are suffixes added to the element content where an element consists of zero, one or more occurences of the child elements. A (?) specifies optional or zero, (+) denotes one or more elements can occur and a (*) denotes zero or more of the elements can occur.<\/p>\n<table class=\"aligncenter\" style=\"border-collapse: collapse; width: 90.8869%; height: 88px;\">\n<tbody>\n<tr style=\"height: 14px;\">\n<td style=\"width: 33.3333%; height: 14px;\">?<\/td>\n<td style=\"width: 33.3333%; height: 14px;\">optional<\/td>\n<td style=\"width: 33.3333%;\">foreword?<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 33.3333%; height: 14px;\">+<\/td>\n<td style=\"width: 33.3333%; height: 14px;\">one or more<\/td>\n<td style=\"width: 33.3333%;\">chapter+<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 33.3333%; height: 14px;\">*<\/td>\n<td style=\"width: 33.3333%; height: 14px;\">zero or more<\/td>\n<td style=\"width: 33.3333%;\">appendix*<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: justify;\">Seperators can also be added with the element declaration, that specifies the order of occurrence when the element has multiple number of child elements. There are two ways we can use to denote the order of occurrence. Using a comma (,) between the child elements specifies that the child elements will occur in the order given. Using a vertical line (|) means that either one or the other child element will occur.<\/p>\n<p style=\"text-align: center;\">\n<\/div>\n<div>\n<table class=\"aligncenter\" style=\"border-collapse: collapse; width: 87.9782%; height: 64px;\">\n<tbody>\n<tr>\n<td style=\"width: 33.3333%;\">,<\/td>\n<td style=\"width: 33.3333%;\">both, in order<\/td>\n<td style=\"width: 33.3333%;\">foreword?, chapter+<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">|<\/td>\n<td style=\"width: 33.3333%;\">or<\/td>\n<td style=\"width: 33.3333%;\">section|chapter<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Grouping:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The elements can be grouped in the element content with parenthesis which can also be specified along with the order of occurrence or the number of occurrences of the child elements.<\/p>\n<p>( ) grouping (section|chapter)+<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Elements without children<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Elements can be defined as empty or without children.<\/p>\n<p style=\"text-align: justify;\">&lt;!ELEMENT name category&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The <em>name<\/em> is the element name used in start and end tags and the <em>category<\/em> may be given as EMPTY. In the DTD the &lt;br&gt; tag can be defined as : &lt;!ELEMENT br EMPTY&gt; In the XML the tag can be used as: &lt;br&gt;&lt;\/br&gt; or just &lt;br \/&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">In the XML, an empty element may not have any content between the start tag and the end tag but an empty element may (and usually does) have attributes.<\/span><\/p>\n<\/div>\n<div>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong> Elements with unstructured children<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The elements can be defined with unstructured children.<\/p>\n<p>&lt;!ELEMENT name category&gt;<\/p>\n<p>Here the category may be ANY.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">This indicates that <em>any<\/em> content character data, elements, even undeclared elements may be used. Since the whole point of using a DTD is to define the structure of a document, ANY should be avoided wherever possible.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The category may be (#PCDATA), indicating that only character data may be used. Here the parentheses are required.<\/p>\n<p>&nbsp;<\/p>\n<p>In the DTD when an element is defined as (#PCDATA), the syntax is given as,<\/p>\n<p>&lt;!ELEMENT paragraph (#PCDATA)&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>In the XML file the element can contain text content<\/p>\n<p>&lt;paragraph&gt;A shot rang out!&lt;\/paragraph&gt;<\/p>\n<p style=\"text-align: justify;\"><em>Note:<\/em> In (#PCDATA), whitespace is kept exactly as entered. Elements may<em> not <\/em>be used within parsed character data. Entities are character data, and <em>may<\/em> be used.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Elements with children<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">An element can contain one or more children.<\/p>\n<p style=\"text-align: justify;\">A category may describe one or more children as given in the syntax below,<\/p>\n<p style=\"text-align: justify;\">&lt;!ELEMENT novel (foreword, chapter+)&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Here the parentheses are required, even if there is only one child, a space must precede the opening parenthesis. Commas (,) between elements mean that <em>all<\/em> children must appear, and must be <em>in the<\/em> <em>order specified<\/em>. The \u201c|\u201d separators means any one child may be used. All child elements must themselves be declared. Children may have children and parentheses can be used for grouping.<\/p>\n<p>&nbsp;<\/p>\n<p>An complete example of the syntax we have seen so far is given in the following example .<\/p>\n<p>&lt;!ELEMENT novel (foreword, (chapter+|section+))&gt;<\/p>\n<\/div>\n<p><strong style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 \u00a0Elements with mixed content<\/strong><\/p>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Elements can also contain mixed content with text data or elements or both.Here #PCDATA describes elements with only character data and #PCDATA can be used in an \u201cor\u201d grouping also as follows,<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;!ELEMENT note (#PCDATA|message)*&gt;<\/p>\n<p>This is called a mixed content<\/p>\n<p>&nbsp;<\/p>\n<p>But certain and rather severe restrictions apply:<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0 #PCDATA must be first<\/p>\n<p>\u2022\u00a0 The separators must be \u201c|\u201d<\/p>\n<p>\u2022\u00a0 \u00a0The group must be starred (meaning zero or more)<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Names and namespaces<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">All names of elements, attributes, and entities, in both the DTD and the XML, are formed by following the rules given as below,<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">\u2022 The name must begin with a letter or underscore.<\/p>\n<p style=\"text-align: justify;\">\u2022 The name may contain only letters, digits, dots, hyphens, underscores, and colons (and, for foreign languages, combining characters and extenders).<\/p>\n<p>&nbsp;<\/p>\n<p>The DTD doesn\u2019t know about namespaces as far as it knows, a colon is just part of a name<\/p>\n<p>The following are different (and both legal),<\/p>\n<p>&lt;!ELEMENT chapter (paragraph+)&gt;<\/p>\n<p>&lt;!ELEMENT myBook:chapter (myBook:paragraph+)&gt;<\/p>\n<p>We need to avoid colons in names, except to indicate namespaces.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>An expanded DTD example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>An example covering all those concepts we have seen so far is given now.<\/p>\n<p>&lt;!DOCTYPE novel [<\/p>\n<p>&lt;!ELEMENT novel<\/p>\n<p>(foreword, chapter+, biography?, criticalEssay*)&gt; &lt;!ELEMENT foreword (paragraph+)&gt; &lt;!ELEMENT chapter (section+|paragraph+)&gt; &lt;!ELEMENT section (paragraph+)&gt; &lt;!ELEMENT biography(paragraph+)&gt;<\/p>\n<p>&lt;!ELEMENT criticalEssay (section+)&gt;<\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;!ELEMENT paragraph (#PCDATA)&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">]&gt;<\/span><\/p>\n<\/div>\n<div>\n<p style=\"text-align: justify;\">\u00a0 \u00a0 \u00a0 The root element is the &lt;novel&gt; element. It consists of elements such as &lt;foreword&gt;, one or more &lt;chapter&gt; elements, zero or one &lt;biography&gt; elements and zero or more &lt;criticalEssay&gt; elements. The &lt;foreword&gt; elements consists of one or more &lt;paragraph&gt; elements. The &lt;chapter&gt; elements consists of one or more &lt;section&gt; or &lt;paragraph&gt; elements.The &lt;section&gt; element consists of one or more &lt;paragraph&gt; elements. The element &lt;biography&gt; consists of one or more &lt;paragraph&gt; elements. The element &lt;criticalEssay&gt; consists of one or more &lt;section&gt; elements. The element &lt;paragraph&gt; consists of #PCDATA.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Attributes and entities<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">In addition to elements, a DTD may declare attributes and entities. An attribute describes information that can be put within the start tag of an element.<\/p>\n<p>&nbsp;<\/p>\n<p>In the XML file we define the attributes as follows,<\/p>\n<p>&lt;dog name=&#8221;Spot&#8221; age=&#8221;3&#8243;&gt;&lt;\/dog&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>In an DTD file the attribute is described as,<\/p>\n<p>&lt;!ATTLIST dog<\/p>\n<p>name\u00a0 CDATA\u00a0 #REQUIRED<\/p>\n<p>age\u00a0\u00a0\u00a0\u00a0\u00a0 CDATA\u00a0 #IMPLIED &gt;<\/p>\n<p>&nbsp;<\/p>\n<p>An entity describes text to be substituted.<\/p>\n<p>In an XML file an entity is defined as,<\/p>\n<p>&amp;copyright;<\/p>\n<p>&nbsp;<\/p>\n<p>In the DTD it is described as,<\/p>\n<p>&lt;!ENTITY copyright &#8220;Copyright Dr. Dave&#8221;&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Attributes<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The format of defining an attribute is,<\/p>\n<p>&lt;!ATTLIST <em>element-name<\/em><\/p>\n<p><em>name\u00a0 type\u00a0 requirement<\/em><\/p>\n<p><em>name\u00a0 type\u00a0 requirement<\/em>&gt;<\/p>\n<p>where the <em>name-type-requirement<\/em> may be repeated as many times as desired.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Note that only spaces separate the parts, so careful counting is essential. The <em>element-name<\/em> tells which element may have these attributes.<span style=\"text-align: initial; font-size: 1em;\">The <\/span><em style=\"text-align: initial; font-size: 1em;\">name<\/em><span style=\"text-align: initial; font-size: 1em;\"> is the name of the attribute. Each element has a <\/span><em style=\"text-align: initial; font-size: 1em;\">type<\/em><span style=\"text-align: initial; font-size: 1em;\">, such as CDATA (character data).<\/span><span style=\"text-align: initial; font-size: 1em;\">The <\/span><em style=\"text-align: initial; font-size: 1em;\">requirement<\/em><span style=\"text-align: initial; font-size: 1em;\"> may be defined as required, optional, or \u201cfixed\u201d. In the XML, attributes may occur in any order<\/span><\/p>\n<\/div>\n<div>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong> Important attribute types<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>There are ten attribute types and these are the most important ones:<\/p>\n<\/div>\n<table class=\"alignright\" style=\"border-collapse: collapse; width: 96.3592%; height: 157px;\">\n<tbody>\n<tr>\n<td style=\"width: 26%;\">CDATA<\/td>\n<td style=\"width: 74%;\">The value is character data<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 26%;\">(man|woman|child)<\/td>\n<td style=\"width: 74%;\">The value is one from this list<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 26%;\">ID<\/td>\n<td style=\"width: 74%;\">The value is a unique identifier. Note: ID values<br \/>\nmust be legal XML names and must be unique within the<br \/>\ndocument<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 26%;\">NMTOKEN<\/td>\n<td style=\"width: 74%;\">The value is a legal XML name. This is sometimes<br \/>\nused to disallow whitespace in the name. It also disallows<br \/>\nnumbers, since an XML name cannot begin with a digit.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 Less important attribute types,<\/strong><\/p>\n<\/div>\n<div>\n<table class=\"aligncenter\" style=\"border-collapse: collapse; width: 91.992%; height: 126px;\">\n<tbody>\n<tr style=\"height: 14px;\">\n<td style=\"width: 22.9585%; height: 14px;\">IDREF<\/td>\n<td style=\"width: 77.0415%; height: 14px;\">The ID of another element<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 22.9585%; height: 14px;\">IDREFS<\/td>\n<td style=\"width: 77.0415%; height: 14px;\">A list of other IDs<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 22.9585%; height: 14px;\">NMTOKENS<\/td>\n<td style=\"width: 77.0415%; height: 14px;\">A list of valid XML names<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 22.9585%; height: 14px;\">ENTITY<\/td>\n<td style=\"width: 77.0415%; height: 14px;\">An entity<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 22.9585%; height: 14px;\">ENTITIES<\/td>\n<td style=\"width: 77.0415%; height: 14px;\">A list of entities<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 22.9585%; height: 14px;\">NOTATION<\/td>\n<td style=\"width: 77.0415%; height: 14px;\">A notation<\/td>\n<\/tr>\n<tr style=\"height: 42px;\">\n<td style=\"width: 22.9585%; height: 42px;\">xml:<\/td>\n<td style=\"width: 77.0415%; height: 42px;\">A predefined XML value<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Requirements<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Recall that an attribute has the form,<\/p>\n<p>&lt;!ATTLIST <em>element-name name\u00a0 type\u00a0 requirement<\/em>&gt;<\/p>\n<p>The <em>requirement<\/em> is one of a default value, enclosed in quotes,<\/p>\n<p>Example: &lt;!ATTLIST degree CDATA &#8220;PhD&#8221;&gt;<\/p>\n<p>The <em>requirement<\/em> can take different values such as #REQUIRED or #IMPLIED or #FIXED.<\/p>\n<\/div>\n<p><span style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 \u00a0\u2022\u00a0 \u00a0#REQUIRED means the attribute must be present.<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">\u00a0\u2022\u00a0 \u00a0#IMPLIED means the attribute is optional.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">\u00a0\u2022\u00a0 #FIXED &#8220;value&#8221; the attribute always has the given value. If specified in the XML, the same value must be used.<\/span><\/p>\n<div>\n<p><strong>\u00a0 <\/strong><\/p>\n<p><strong>Entities<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Entities are Variables used to define shortcuts to common text. Entities should not be confused with character references, which are numerical values between &amp; and #.There are exactly five predefined entities: &amp;lt;, &amp;gt;, &amp;amp;, &amp;quot;, and &amp;apos;.Additional entities can be defined in the DTD by the following syntax,<\/p>\n<p style=\"text-align: justify;\">&lt;!ENTITY copyright &#8220;Copyright Dr. Dave&#8221;&gt;<\/p>\n<p style=\"text-align: justify;\">Entities can be defined in another document by,<\/p>\n<p style=\"text-align: justify;\">&lt;!ENTITY copyright SYSTEM &#8220;MyURI&#8221;&gt;<\/p>\n<p style=\"text-align: justify;\">An example of use in the XML as,<\/p>\n<p style=\"text-align: justify;\"><em>This document is &amp;copyright; 2002.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Another example: XML<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<\/p>\n<p>&lt;!DOCTYPE weatherReport SYST EM &#8220;http:\/\/www.mysite.com\/mydoc.dtd&#8221;&gt; &lt;weatherReport&gt;<\/p>\n<p>&lt;date&gt;05\/29\/2002&lt;\/date&gt;<\/p>\n<p>&lt;location&gt;<\/p>\n<p>&lt;city&gt;Chennai&lt;\/city&gt; &lt;state&gt;Tamilnadu&lt;\/state&gt; &lt;country&gt;INDIA&lt;\/country&gt;<\/p>\n<p>&lt;\/location&gt;<\/p>\n<p>&lt;temperature -range&gt;<\/p>\n<p>&lt;high scale=&#8221;F&#8221;&gt;84&lt;\/high&gt;<\/p>\n<p>&lt;low scale=&#8221;F&#8221;&gt;51&lt;\/low&gt;<\/p>\n<p>&lt;\/temperature -range&gt;<\/p>\n<p>&lt;\/weatherReport&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>The DTD for this example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;!ELEMENT weatherReport (date, location, temperature -range)&gt;<\/p>\n<p>&lt;!ELEMENT date (#PCDATA)&gt;<\/p>\n<p>&lt;!ELEMENT location (city, state, country)&gt;<\/p>\n<p>&lt;!ELEMENT city (#PCDATA)&gt;<\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;!ELEMENT state (#PCDATA)&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;!ELEMENT country (#PCDATA)&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;!ELEMENT temperature -range ((low, high)|(high, low))&gt; &lt;!ELEMENT low (#PCDATA)&gt; &lt;!ELEMENT high (#PCDATA)&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;!ATTLIST low scale (C|F) #REQUIRED&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;!ATTLIST high scale (C|F) #REQUIRED&gt;<\/span><\/p>\n<\/div>\n<div>\n<p><strong>\u00a0 \u00a0<\/strong><\/p>\n<p><strong>Inline DTDs<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">If a DTD is used only by a single XML document, it can be put directly in that document. An inline DTD can be used only by the document in which it occurs.<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;?xml version=&#8221;1.0&#8243;&gt;<\/p>\n<p>&lt;!DOCTYPE myRootElement [<\/p>\n<p>&lt;!&#8211; DTD content goes here &#8211;&gt;<\/p>\n<p>]&gt;<\/p>\n<p>&lt;myRootElement&gt;<\/p>\n<p>&lt;!&#8211; XML content goes here &#8211;&gt;<\/p>\n<p>&lt;\/myRootElement&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Inline DTDs &#8211; Example<\/strong><\/p>\n<\/div>\n<p><span style=\"text-align: initial; font-size: 1em;\">\u00a0 \u00a0 &lt;!DOCTYPE company [<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT company<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT person<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT ssn<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT name<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT office<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT phone<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT product<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT pi d<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt; ! ELEMENT description<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( (person | product)*) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( ssn, name, office, phone?) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( pi d, name, description? ) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">( # PCDATA) &gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">]&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;company&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;person&gt; &lt;ssn&gt; 12345678 &lt; \/ssn&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;name&gt; John &lt;\/name&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;office&gt; B432 &lt;\/office&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;phone&gt; 1234 &lt;\/phone&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;\/person&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;product&gt; \u2026 &lt;\/product&gt;<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">\u2026<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">&lt;\/company&gt;<\/span><\/p>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>External DTDs<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">An external DTD which is a DTD defined as a separate document is declared with a SYSTEM or a PUBLIC command. The syntax is given as follows,<span style=\"text-align: initial; font-size: 1em;\">&lt;!DOCTYPE myRootElement SYSTEM &#8220;http:\/\/www.mysite.com\/mydoc.dtd&#8221;&gt;<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">The name that appears after DOCTYPE (in this example, myRootElement) must match the name of the XML document\u2019s root element. We will use SYSTEM for external DTDs that we define for ourself and we will use PUBLIC for official and published DTD&#8217;s. External DTDs can only be referenced with a URL.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">The file extension for an external DTD is .dtd.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\"><span style=\"text-align: initial; font-size: 1em;\">External DTD&#8217;s are almost always preferable to inline DTD&#8217;s, since they can be used by more than one document.<\/span><\/p>\n<\/div>\n<div>\n<p><strong>\u00a0 <\/strong><\/p>\n<p><strong>\u00a0External DTDs &#8211; Example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;!DOCTYPE company SYSTEM \u201ccom pany.dtd\u201d&gt;<\/p>\n<p>&lt;company&gt;<\/p>\n<p>&lt;person&gt; &lt;ssn&gt; 12345678 &lt; \/ssn&gt;<\/p>\n<p>&lt;name&gt; John &lt;\/name&gt;<\/p>\n<p>&lt;office&gt; B432 &lt;\/office&gt;<\/p>\n<p>&lt;phone&gt; 1234 &lt;\/phone&gt;<\/p>\n<p>&lt;\/person&gt;<\/p>\n<p>&lt;product&gt; \u2026 &lt;\/product&gt;<\/p>\n<p>\u2026<\/p>\n<p>&lt;\/company&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>In this example the DTD is defined in a separate document called \u201ccompany.dtd\u201d and referred in the<\/p>\n<p>XML document after DOCTYPE.<\/p>\n<p>The DTD can reside at a different URL, and then we refer to it as,<\/p>\n<p>&lt;!DOCTYPE company SYSTEM \u201chttp:\/\/www.mydtd.com\/com pany.dtd\u201d&gt;<\/p>\n<p>An example of <strong>TV Schedule DTD<\/strong> is given,<\/p>\n<p>&lt;!DOCTYPE TVSCHEDULE [<\/p>\n<p>&lt;!ELEMENT TVSCHEDULE (CHANNEL+)&gt;<\/p>\n<p>&lt;!ELEMENT CHANNEL (BANNER, DAY+)&gt;<\/p>\n<p>&lt;!ELEMENT BANNER (#PCDATA)&gt;<\/p>\n<p>&lt;!ELEMENT DAY ((DAT E, HOLIDAY) | (DAT E, PROGRAMSLOT+))+&gt; &lt;!ELEMENT HOLIDAY (#PCDATA)&gt;\u00a0 \u00a0 \u00a0 &lt;!ELEMENT DAT E (#PCDATA)&gt;<\/p>\n<p>&lt;!ELEMENT PROGRAMSLOT (TIME, TITLE, DESCRIPTION?)&gt; &lt;!ELEMENT TIME (#PCDATA)&gt; &lt;!ELEMENT TITLE (#PCDATA)&gt;<\/p>\n<p>&lt;!ELEMENT DESCRIPTION (#PCDATA)&gt;<\/p>\n<p>&lt;!ATTLIST TVSCHEDULE NAME CDATA #REQUIRED&gt; &lt;!ATTLIST CHANNEL CHAN CDATA #REQUIRED&gt; &lt;!ATTLIST PROGRAMSLOT VTR CDATA #IMPLIED&gt; &lt;!ATTLIST TITLE RATING CDATA #IMPLIED&gt; &lt;!ATTLIST TITLE LANGUAGE CDATA #IMPLIED&gt;<\/p>\n<p>]&gt;<\/p>\n<\/div>\n<p>Another Example for <strong>Newspaper Article DTD<\/strong> is also given for understanding,<\/p>\n<p>&lt;!DOCTYPE NEWSPAPER [<\/p>\n<p>&lt;!ELEMENT NEWSPAPER (ARTICLE+)&gt;<\/p>\n<p>&lt;!ELEMENT ARTICLE (HEADLINE, BYLINE, LEAD, BODY, NOT ES)&gt; &lt;!ELEMENT HEADLINE (#PCDATA)&gt;\u00a0 \u00a0 \u00a0 &lt;!ELEMENT BYLINE (#PCDATA)&gt;<\/p>\n<p>&lt;!ELEMENT LEAD (#PCDATA)&gt;<\/p>\n<p>&lt;!ELEMENT BODY (#PCDATA)&gt;<\/p>\n<p>&lt;!ELEMENT NOT ES (#PCDATA)&gt;<\/p>\n<p>&lt;!ATTLIST ARTICLE AUTHOR CDATA #REQUIRED&gt; &lt;!ATTLIST ARTICLE EDITOR CDATA #IMPLIED&gt; &lt;!ATTLIST ARTICLE DAT E CDATA #IMPLIED&gt; &lt;!ATTLIST ARTICLE EDITION CDATA #IMPLIED&gt; &lt;!ENTITY NEWSPAPER &#8220;Vervet Logic Times&#8221;&gt; &lt;!ENTITY PUBLISHER &#8220;Vervet Logic Press&#8221;&gt;<\/p>\n<p>&lt;!ENTITY COPYRIGHT &#8220;Copyright 1998 Vervet Logic Press&#8221;&gt; ]&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Limitations of DTDs<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">DTDs are a very weak specification language and we can\u2019t put any restrictions on element contents. It is difficult to specify when all the children must occur, but may be in any order or this element must occur a certain number of times. There are only ten data types for attribute values.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">But most of all DTDs aren\u2019t written in XML. If we want to do any validation,we need one parser for the XML <em>and<\/em> another for the DTD. This makes XML parsing harder than it needs to be. In order to support this, there is a newer and more powerful technology called XML Schemas. However, DTDs are still very much in use.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">This module provides knowledge about XML DTD.The module identifies the purpose of DTD with few examples. The module also discusses about Inline and External D<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Web Links<\/strong><\/p>\n<ul>\n<li><em>www.w3schools.com\/<strong>xml<\/strong><\/em><\/li>\n<li><em>www.cis.upenn.edu\/~matuszek\/cit597-2003\/Lectures\/08-<strong>dtd<\/strong>.<strong>ppt<\/strong><\/em><\/li>\n<li><em>www.tutorialspoint.com\/<strong>xml<\/strong><\/em><\/li>\n<\/ul>\n","protected":false},"author":4,"menu_order":8,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["dr-m-vijayalakshmi"],"pb_section_license":""},"chapter-type":[],"contributor":[58],"license":[],"class_list":["post-68","chapter","type-chapter","status-publish","hentry","contributor-dr-m-vijayalakshmi"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/68","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/users\/4"}],"version-history":[{"count":21,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/68\/revisions"}],"predecessor-version":[{"id":628,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/68\/revisions\/628"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/68\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapter-type?post=68"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/contributor?post=68"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/license?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}