Some XML DTD examples

Lots of working examples of XML and DTD are available in the internet. Let us consider a sample XML file of the format given under,

_______________________________________________


_______________________________________________

<?xml version="1.0" ?>
<videos>
<music>
<title>Video Title 1 </title>
<artist>Artist 1 </ artist >
</music>
< music >
<title>Video Title 2 </title>
< artist > Artist 2 </ artist >
< artist > Artist 3 </ artist >
</ music >
</ videos >

The above XML file has data related to music videos. In this XML file the root node is the <videos> and this can have any number of <music> elements. The <music> element can have a single <title> and any number of <artist> child nodes. For this structure you can write the DTD as,

<!ELEMENT videos ( music+ ) >
<!ELEMENT music ( title, artist+ ) >
<!ELEMENT title ( #PCDATA ) >
<!ELEMENT artist ( #PCDATA ) >

The ELEMENT word indicates that the word next to that is an element and the nodes of that particular element are given in the brackets. The + sign after the node in the bracket denotes that it could be any number of nodes. The #PCDATA indicates that it is a text node that has some value in it.


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.

_______________________________________

Recommended XML Books

cover
cover
cover
cover
cover
cover


 

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!


New XML Books Titles - Best Seller's @ Amazon.com

Visit XML Training Material Guide Homepage

Technology helps engage students - how do classroom instruction and social dynamics change when the classroom is completely dependant on modern technology?

Dallas Web Design- local Dallas web design firm offers site design and backend system development