Home
Technical Training
XML Tutorials
XML - Elements in Document Type Definitions (DTD)
XML - Elements in Document Type Definitions (DTD) - Page 2
XML - Elements in Document Type Definitions (DTD) - Page 3
The sequence operator (,) is used to provide sequence of child elements.
The following declaration requires first_name followed by middle_name followed by last_name
< ! ELEMENT name (fist_name, middle_name, last_name ) >
< name >
< first_name >Nick< /first_name >
< middle_name >John< /middle_name >
< last_name >Price< /last_name >
< /name >
is valid while
< name >
< last_name >Price< /last_name >
< first_name >Nick< /first_name >
< middle_name >John< /middle_name >
< /name >
or
< name >
< middle_name >John< /middle_name >
< first_name >Nick< /first_name >
< last_name >Price< /last_name >
< /name >
or any other such combinations are invalid.
The Optional operator (?) is used to declare zero or once appearance of the element
Thus for the declaration
< !ELEMENT EVENT (LOCATION,SPONSOR?) >
< EVENT >
< LOCATION >West Bay Ballpark< /LOCATION >
< /EVENT >
OR
< EVENT >
< LOCATION >West Bay Ballpark< /LOCATION >
< SPONSOR >Flying Toys< /SPONSOR >
< /EVENT >
are valid.
while
< EVENT >
< LOCATION >West Bay Ballpark< /LOCATION >
< SPONSOR >Flying Toys< /SPONSOR >
< SPONSOR >Plastic Toys< /SPONSOR >
< /EVENT >
is invalid.
The plus sign (+) is used to indicate one or more instances of the element.
Thus for the declaration
< !ELEMENT EVENTLIST (EVENT+) >
< EVENTLIST >
< EVENT >Balsa Wood Flyer Days< /EVENT >
< EVENT >Sundays in the Park< /EVENT >
< EVENT >Teach Your Child to Fly< /EVENT >
< /EVENTLIST >
or
< EVENTLIST >
< EVENT >Balsa Wood Flyer Days< /EVENT >
< /EVENTLIST >
are valid
while
< EVENTLIST >
< /EVENTLIST >
is not valid.
This tutorial is part of a XML Tutorials tutorial series. Read it from the beginning and learn yourself.
Technical Training
XML TutorialsTable of Contents
XML - Elements in Document Type Definitions (DTD)
XML - Elements in Document Type Definitions (DTD) - Page 2
XML - Elements in Document Type Definitions (DTD) - Page 3XML - Elements in Document Type Definitions (DTD) Page - 3
Page 3 of 3
Author : Exforsys Inc. Published on: 14th Jun 2006
XML - Elements in Document Type Definitions (DTD)
.
.
.
Ads
The sequence operator (,) is used to provide sequence of child elements.
The following declaration requires first_name followed by middle_name followed by last_name
< ! ELEMENT name (fist_name, middle_name, last_name ) >
< name >
< first_name >Nick< /first_name >
< middle_name >John< /middle_name >
< last_name >Price< /last_name >
< /name >
is valid while
< name >
< last_name >Price< /last_name >
< first_name >Nick< /first_name >
< middle_name >John< /middle_name >
< /name >
or
< name >
< middle_name >John< /middle_name >
< first_name >Nick< /first_name >
< last_name >Price< /last_name >
< /name >
or any other such combinations are invalid.
The Optional operator (?) is used to declare zero or once appearance of the element
Thus for the declaration
< !ELEMENT EVENT (LOCATION,SPONSOR?) >
< EVENT >
< LOCATION >West Bay Ballpark< /LOCATION >
< /EVENT >
OR
< EVENT >
< LOCATION >West Bay Ballpark< /LOCATION >
< SPONSOR >Flying Toys< /SPONSOR >
< /EVENT >
are valid.
while
< EVENT >
< LOCATION >West Bay Ballpark< /LOCATION >
< SPONSOR >Flying Toys< /SPONSOR >
< SPONSOR >Plastic Toys< /SPONSOR >
< /EVENT >
is invalid.
The plus sign (+) is used to indicate one or more instances of the element.
Thus for the declaration
< !ELEMENT EVENTLIST (EVENT+) >
< EVENTLIST >
< EVENT >Balsa Wood Flyer Days< /EVENT >
< EVENT >Sundays in the Park< /EVENT >
< EVENT >Teach Your Child to Fly< /EVENT >
< /EVENTLIST >
or
< EVENTLIST >
< EVENT >Balsa Wood Flyer Days< /EVENT >
< /EVENTLIST >
are valid
while
< EVENTLIST >
< /EVENTLIST >
is not valid.
Ads
The asterisk (*) signifies zero or more appearances of the elements.
Thus for the declaration
< !ELEMENT EVENT (LOCATION*, EVENT-NAME) >
< EVENT >
< LOCATION >West Bay Ballpark< /LOCATION >
< LOCATION >North Side Park< /LOCATION >
< EVENT-NAME >Sundays in the Park< /EVENT-NAME >
< /EVENT >
OR
< EVENT >
< EVENT-NAME >Sundays in the Park< /EVENT-NAME >
< /EVENT >
are valid.
Read Next: XML Advantages
XML Tutorials
- Working with XML in C
- Working with XML in Perl
- Working with XML in Python
- Working with XML in Flash
- Working with XML in Oracle
- Working with XML in Visual Basic
- Using XML with Microsoft Excel
- XML Spy
- XML and Service Oriented Architecture
- XML SQL Server
- XML Security
- XML Remote Calling Procedure
- XML Processing
- XML Parsing
- XML Web Services
- XML Disadvantages
- XML Advantages
- XML - Elements in Document Type Definitions (DTD)
- XML - Document Type Definitions (DTD)
- XML - Elements, Attributes, Entities
- XML Introduction







