Print

Print


Sebastian Rahtz wrote:
>Dieter Köhler wrote:
>>Validating XML processors must read the complete DTD. Non-validating 
>>processors may fail to detect the reference to an undeclared entity, but 
>>this can not cause the documents to be invalid.
>if you declare an entity called "foo" in the external DTD, and then use 
>&foo; in the document, the document will not be well-formed according to a 
>non-validating parser.

For a non-validating processor a reference to an undeclared entity is only 
a violation of a well-formedness constraint for a document with 
"standalone='yes'" in its XML declaration. If "standalone='no'" or if no 
standalone declaration is present, the processor must accept the reference 
(of course it cannot expand it). See XML spec. 4.1, prod. [68] "WFC Entity 
Declared", "http://www.w3.org/TR/2006/REC-xml-20060816/#wf-entdeclared".

>>Of course, it depends on the particular application how it copes with an 
>>entity reference that it can not expand.
>no. its an error if you cannot expand an entity - well, in my reading of 
>XML, anyway

This is only the case for validating, but not for non-validating 
processors.  The XML spec is very clear about that fact: "If the entity is 
external, and the processor is not attempting to validate the XML document, 
the processor MAY, but need not, include the replacement text. If a 
non-validating processor does not include the replacement text, it MUST 
inform the application that it recognized, but did not read the entity." 
(XML spec. 4.4.3, 
"http://www.w3.org/TR/2006/REC-xml-20060816/#include-if-valid"; for more 
details see the rest of the paragraph.)

Dieter Köhler