Exforsys.com
 

Sponsored Links

 

XML Tutorials

 
Home Tutorials XML
 

XML - Elements in Document Type Definitions (DTD)

 
Category: XML
Comments (0)

XML - Elements in Document Type Definitions (DTD) - Page 3

Page 3 of 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.




First Page: XML - Elements in Document Type Definitions (DTD)


Read Next: XML Advantages



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape