Undeclared Entities as Well-Formedness Errors

All this is just trying to say that when a document contains an entity reference (i.e. a & followed by a Name, followed by a ;), the entity has to be declared, EXCEPT...

The "except" is all about the difference between well-formedness and validity. Notice that we are currently in a well-formedness rule. This means that we're not validating; and non-validating processors don't have to read any external entities, including the external subset of the DTD.

So it's perfectly possible that some entity might have been declared, but that the processor has (quite rightly) not read that declaration. So this list of conditions basically lists all the conditions in which a non-validating processor can be confident of having read all the declarations; in these cases, then if you hit a reference to an entity that wasn't declared, it's an error. In fact, since this is a well-formedness rule, it's a fatal error, which means you have to stop processing the document.

Back-link to spec

Copyright © 1998, Tim Bray. All rights reserved.