2.2.13 [XML] Section 4.1, Character and Entity References
C0017:
-
Well-formedness constraint: Entity Declared In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", for an entity reference that does not occur within the external subset or a parameter entity, the Name given in the entity reference MUST match that in an entity declaration that does not occur within the external subset or a parameter entity, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. The declaration of a general entity MUST precede any reference to it which appears in a default value in an attribute-list declaration. Note that non-validating processors are not obligated to to read and process entity declarations occurring in parameter entities or in the external subset; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone='yes'
MSXML3 and MSXML6
MSXML3 and MSXML6 are validating parsers.
C0018:
-
Validity constraint: Entity Declared In a document with an external subset or parameter entity references with "standalone='no'", the Name given in the entity reference MUST match that in an entity declaration. For interoperability, valid documents SHOULD declare the entities amp, lt, gt, apos, quot, in the form specified in 4.6 Predefined Entities. The declaration of a parameter entity MUST precede any reference to it. Similarly, the declaration of a general entity MUST precede any attribute-list declaration containing a default value with a direct or indirect reference to that general entity.
MSXML3 and MSXML6
A general entity can be declared after an attribute-list declaration if the attribute-list declaration contains a default value with an indirect reference to the general entity.