Declarations

Next come the individual declarations, and in well-commented DTDs each such declaration should also have a comment expanding on it in more detail. Let's begin with a simple element declaration, such as this one for an amount:

<!ELEMENT Amount (#PCDATA)>

All the declaration tells us is that the amount contains text and no child elements. It does not say whether this is an amount of money, an amount of time, an amount of oranges, or anything else. According to this declaration all of the following are valid:

 <Amount>$3.45</Amount> <Amount>3.45</Amount> <Amount>-3.45</Amount> <Amount>(3.45)</Amount> <Amount>3.45 EUR</Amount> <Amount>+3.45 EUR</Amount> <Amount>23</Amount> <Amount /> <Amount>Oh Susanna, won't you sing a song for me?</Amount> ...

Get Effective XML: 50 Specific Ways to Improve Your XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.