Rules for Creating Document Type Definition, or DTD, Elements

Basically, you prepare and use a Document Type Definition (DTD) to add structure and logic, making it easier to ensure that all essential features are present — in the right order — in your XML document. You may develop many rules in your DTD that control how elements can be used in an XML document.





















































SymbolMeaningExample
#PCDATAContains parsed character data or text<element (#PCDATA)>
#PCDATA, element-nameContains text and another element; class="code">#PCDATA is always listed first in a rule<element (#PCDATA,
child)*>
, (comma)Must use in this order<element (child1, child2,
child3)>
| (pipe bar)Use only one element of the choices provided<element (child1 | child2 |
child3)>
element-name (by itself)Use one time only<element (child)>
element-name?Use either once or not at all<element (child1, child2?,
child3?)>
element-name+Use either once or many times<element (child1+, child2?,
child3)>
element-name*Use once, many times, or not at all<element (child1*, child2+,
child3)>
( )Indicates groups; may be nested<element (#PCDATA | child)*> or
<element ((child1*, child2+, child3)* |
child4)>



dummies

Source:http://www.dummies.com/how-to/content/rules-for-creating-document-type-definition-dtd-el.html

No comments:

Post a Comment