Understanding the different parts of XML dtd with a sample XML DTD

You can easily understand the different parts of an XML DTD with a sample DTD document. Consider the following sample code in a DTD file.

<!ELEMENT books ( book+ ) >
<!ELEMENT book ( title, author+ ) >
<!ATTLIST book category NMTOKEN #REQUIRED >
<!ELEMENT title ( #PCDATA ) >
<!ELEMENT author ( #PCDATA ) >

The ELEMENT keyword indicates that an element is defined in the document. The word that follows the keyword is the name of the element.

After the element the child nodes of that element are given in brackets. A plus sign by the side of the child node indicates that there could be one or more child nodes of that name.

There are different notations to define different patterns like '?' and '*' after the name of the child node.

The attributes of an element is defined using the keyword ATTLIST. If that particular attribute is always required you will be using the keyword #REQUIRED.

The NMTOKEN in the above examples indicates the type of data that the attribute holds. An NMTOKEN can hold letters, point, digits, hyphen, underline and colon. The word #PCDATA indicates that the node can have text data that is parsed by the parser.



.

SetApp - 100 Apps for everything you ever wanted to do on Mac

FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________



 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!

Visit XML Training Material Guide Homepage

 

 

“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

Copyright - © 2004 - 2019 - All Rights Reserved.