O'Reilly logo

Effective XML: 50 Specific Ways to Improve Your XML by Elliotte Rusty Harold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required