How to build XML DTD If you know how you want your XML document to be, then you can easily create an XML DTD. First you should be clear in your requirement for the XML document. The next step is to know the syntax of the DTD and how to create it. Suppose you want your XML document to hold the data regarding music CDs. Then you might require a <title> element that would hold the title of the music CD. Then each of that title might have some artists who were involved in creating that CD. So it is necessary for a tag like <artist> to be present. There could be more than one artist in creating that CD. So, multiple <artist> elements are needed. Based on these you can create a DTD as given below: <!ELEMENT music ( cd+ ) > If you examine the above DTD you will find that the ELEMENT keyword is used to define an element. The word following that keyword is the name of the element and the words within the bracket indicate the child elements. So, from the above code you will find that the root element is <music> and it would have one of more <cd> elements. One or More is indicated by the '+' sign. The <cd> element would have <title> and <artist> element. The '+' sign indicates that there would be one or more <artist> element. The PCDATA indicates that the element would hold only text data that is parsed.
|
|
|||
|
||||
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”
Copyright - © 2004 - 2019 - All Rights Reserved.