# Corrections to Chapter 8 of The XML Bible, Document Type Definitions and Validity

p. 201: In the list of baseball statistics elements, `HOME_RUNS` and `RUNS` are listed twice each. The second occurrences should be `HOME_RUNS_AGAINST` and `RUNS_AGAINST`. `HITS_AGAINST` should also be included.

pp. 203-204: In Listing 8-4, Eric Ludwick's statistics are incorrect. The XML is fine. it's just that the numbers are off. The correct stats are:

``````          <PLAYER>
<SURNAME>Ludwick</SURNAME>
<GIVEN_NAME>Eric</GIVEN_NAME>
<POSITION>Starting Pitcher</POSITION>
<WINS>1</WINS>
<LOSSES>4</LOSSES>
<SAVES>0</SAVES>
<GAMES>13</GAMES>
<GAMES_STARTED>6</GAMES_STARTED>
<COMPLETE_GAMES>0</COMPLETE_GAMES>
<SHUT_OUTS>0</SHUT_OUTS>
<ERA>7.44</ERA>
<INNINGS>32.2</INNINGS>
<HITS_AGAINST>46</HITS_AGAINST>
<HOME_RUNS_AGAINST>7</HOME_RUNS_AGAINST>
<RUNS_AGAINST>31</RUNS_AGAINST>
<EARNED_RUNS>27</EARNED_RUNS>
<HIT_BATTER>0</HIT_BATTER>
<WILD_PITCHES>2</WILD_PITCHES>
<BALK>0</BALK>
<WALKED_BATTER>17</WALKED_BATTER>
<STRUCK_OUT_BATTER>27</STRUCK_OUT_BATTER>
</PLAYER>
``````

p. 205: A pitcher's Earned Run Average (ERA) is calculated by multiplying the number of earned runs given up by nine, then dividing the product by the number of innings pitched. The quotient to two decimal places is the Earned Run Average. Thus it is not generally a floating point number between 0.0 and 1.0 as I mistakenly claimed. In fact, a consistent ERA below 1.0 would almost certainly win a pitcher the Cy Young award. Thus in the note, change "the ERA must be a floating point number between 0.0 and 1.0" to "the ERA must be a non-negative floating point number with two decimal places".

p. 206: There's a minor formatting problem in the list of elements a `PLAYER` may contain. For some reason the `ING` in `STEALING` has become bold. It should be `STEALING`.

p. 230-232: In Listing 8-12, the double hyphens in the comments all got turned into em dashes. (I blame Quark XPress for this.) They should all begin with `<--` and end with `-->`; not `<—` and end with `—>`. The online version and the version on the CD have this correct.

p. 236-238: In Listing 8-13, the double hyphens in the comments all got turned into em dashes. (I blame Quark for this.) They should all begin with `<--` and end with `-->`; not `<—` and end with `—>`. The online version and the version on the CD have this correct.

p. 238: At the beginning of Listing 8-14, the standalone document declaration should have the value no. That is,

`<?xml version="1.0" standalone="no"?>`

However, the reason's a little more involved than I claim on p. 238. A document with an external DTD can have standalone="yes". However, it cannot do so if there are any element declarations for elements with element content whose instances in the document contain white space. The reason is that the external DTD tells the parser that this white space can be ignored. Thus a parser that uses the DTD will report different results than one that doesn't. Hence, standalone="no". The XML specification gives three other circumstances in which an document with an external DTD subset has to have standalone="no". Between them these four rules require standalone="no" for almost all real world DTDs. You're never wrong using standalone="no" for a document with an external DTD subset. Consequently, it's easiest to just use standalone="no" for all documents with external DTDs or DTD subsets.

p. 245: The paragraph and code sample at the end of the chapter, right before the summary, are incorrect. While entities can be redeclared in an internal DTD subset, attributes cannot. Doing so is a validity error. Just cross out these two paragraphs.

Copyright 1999, 2000 Elliotte Rusty Harold
elharo@metalab.unc.edu