dictionary_dtd.xml - XML DTD Document Type Example

This section provides XML DTD document type example, dictionary_dtd.xml, which uses ELEMENT, ATTLIST, and ENTITY DTD statements to define a document type called 'dictionary'.

Let's use the following XML file, dictionary_dtd.xml, to see how different DTD statements can be used:

<?xml version="1.0"?>
<!-- dictionary_dtd.xml
 - Copyright (c) 2014, HerongYang.com, All Rights Reserved.
-->
<!DOCTYPE dictionary [
 <!ELEMENT dictionary (note, word+)>
 <!ELEMENT note ANY>
 <!ELEMENT word (update?, name, definition+, usage*)>
 <!ELEMENT update EMPTY>
 <!ATTLIST update 
  date CDATA #REQUIRED 
  editor CDATA #IMPLIED
 >
 <!ELEMENT name (#PCDATA)>
 <!ATTLIST name is_acronym (true | false) "false">
 <!ELEMENT definition (#PCDATA)>
 <!ELEMENT usage (#PCDATA | i)*>
 <!ELEMENT i (#PCDATA)>
 <!ENTITY herong "Dr. Herong Yang">
]>
<dictionary>
 <note>Copyright (c) 2002 by &herong;</note>
 <word>
  <name is_acronym="true">POP</name>
  <definition>Post Office Protocol</definition>
  <definition>Point Of Purchase</definition>
 </word>
 <word>
  <update date="2002-12-23"/> 
  <name is_acronym="true">XML</name>
  <definition>eXtensible Markup Language</definition>
 </word>
 <word>
  <update date="2002-12-23" editor="Herong Yang"/> 
  <name>markup</name>
  <definition>The amount added to the cost price to calculate 
the selling price</definition>
 </word>
</dictionary>

Last update: 2014.

Table of Contents

 About This Book

 Introduction of XML (eXtensible Markup Language)

 XML File Syntax

 XML File Browsers

 DOM (Document Object Model) Programming Interface

 SAX (Simple API for XML) Programming Interface

 DTD (Document Type Definition) Introduction

Syntaxes of DTD Statements

 DOCTYPE - Document Type Declaration Statement

 ELEMENT - Element Declaration Statement

 ATTLIST - Attribute List Declaration Statement

 ENTITY - Entity Declaration Statement

dictionary_dtd.xml - XML DTD Document Type Example

 Validating an XML Document against the Specified DTD Document Type

 XSD (XML Schema Definition) Introduction

 Syntaxes of XSD Statements

 Validating XML Documents Against Specified XML Schemas

 XSL (Extensible Stylesheet Language) Introduction

 XSLT (XSL Transformations) Introduction

 Java Implementation of XSLT

 XPath (XML Path) Language

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 XML Notepad - XML Editor

 XML Tools Plugin for Notepad++

 XML 1.1 Changes and Parsing Examples

 Outdated Tutorials

 References

 PDF Printing Version