alt
Advertisement
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow XML arrow XML - Elements in Document Type Definitions (DTD)
Site Search


XML - Elements in Document Type Definitions (DTD)
Article Index
XML - Elements in Document Type Definitions (DTD)
Page 2
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.

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.


Trackback(0)
Comments (0)add comment

Write comment

busy

 
< Prev   Next >
Sponsored Links
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape