
Understanding XML DTD through an exampleKnowing the different components of a DTD file would help you in understanding how the XML file is formed based on a DTD.
_______________________________________________ The DTD file defines the rules on how the elements of the XML file should be organized. The number of child nodes for a particular node and the type of value of the particular node are all defined in a DTD. Look at the following DTD file, <!ELEMENT
books ( book+ ) > The 'ELEMENT' defines that the name that follows that word is an element of the XML file. Take the first statement. In that there is an element 'books' defined and that 'books' element can have any number of 'book' element as its child. That is why it is given as 'book+'. Now come to the second statement. It states that the 'book' element can have child elements as 'title' and 'author' and there can be only one 'title' and one 'author' element within the 'book' element. That is why the '+' is missing in it. The 'title' and the 'author' are text nodes that have some value in it. That is denoted by #PCDATA. Based on the above definition a typical XML document might look like, <books> There could be any number of 'book' elements in this XML file according to the DTD document.
|
Cisco
CCNA Certification Video Tutorial Guide - Learn How to Pass the Cisco
CCNA 640-802 Exam... Guaranteed!
| |||
|
| ||||