DTDDTD Defination
Building BlocksElements
<! ELEMENT element-name category> or <!ELEMENT element-name (element-content)>
Attributes
Enities
PCDATA (Parsed Character Data)
CDATA( Character Data)
DTD Validation
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.validateOnParse="true";xmlDoc.load("note_dtd_error.xml");document.write("<br>Error Code: ");document.write(xmlDoc.parseError.errorCode);document.write("<br>Error Reason: ");document.write(xmlDoc.parseError.reason);document.write("<br>Error Line: ");document.write(xmlDoc.parseError.line);
Use of Elements vs. Attributes
<note date="12/11/2002">......</note>A date element is used in the second example:<note> <date>12/11/2002</date>..............</note>An expanded date element is used in the third: (THIS IS MY FAVORITE):<note> <date> <day>12</day> <month>11</month> <year>2002</year> </date>.......</note>
Example
<!DOCTYPE NEWSPAPER [<!ELEMENT NEWSPAPER (ARTICLE+)><!ELEMENT ARTICLE (HEADLINE,BYLINE,LEAD,BODY,NOTES)><!ELEMENT HEADLINE (#PCDATA)><!ELEMENT BYLINE (#PCDATA)><!ELEMENT LEAD (#PCDATA)><!ELEMENT BODY (#PCDATA)><!ELEMENT NOTES (#PCDATA)><!ATTLIST ARTICLE AUTHOR CDATA #REQUIRED><!ATTLIST ARTICLE EDITOR CDATA #IMPLIED><!ATTLIST ARTICLE DATE CDATA #IMPLIED><!ATTLIST ARTICLE EDITION CDATA #IMPLIED><!ENTITY NEWSPAPER "Vervet Logic Times"><!ENTITY PUBLISHER "Vervet Logic Press"><!ENTITY COPYRIGHT "Copyright 1998 Vervet Logic Press">]>
Conclution