Understanding XML DTD #implied

An XML DTD defines how an XML document should be organized. The order of the elements and the number of elements are defined in the DTD.


_______________________________________________

If you want to define the attributes and how they should be created in an XML element you will be using ATTLIST in the DTD. Consider the example where there are multiple book nodes and each book node has a title node and one or more author node.

The book element has an attribute called category. In our case it is not compulsory to have an attribute in that element. In such cases you will be using the keyword #IMPLIED. This implies that the attribute is not compulsory to be present in the element.

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

#DEFAULT, #REQUIRED, and #FIXED are the other values that could be used for the attribute.



_______________________________________________

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

 

 

Copyright - © 2004 - 2017 - All Rights Reserved.