[XML-SIG] Re: Skipped entities under SAX
"Martin v. Löwis"
martin at v.loewis.de
Sat Apr 24 06:53:57 EDT 2004
Derek Fountain wrote:
> Correct, but is there a reason it chooses to throw an error, rather than hand
> it over to the handler's skipped entity routine? If it chose the latter, it
> would obviously skip all entities and hand them all over, but why is that
> route not preferable to throwing an error and stopping the script?
Yes. The document is ill-formed, as it violates this well-formedness
condition from section 4.1 of XML 1.0:
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.
Your document is without any DTD, so to be well-formed, it must not
contain any entity reference except for the five predefined ones.
According to section 5.1, a processor must report a violation of
a WFC. In SAX, such violations are reported to the error handler,
which defaults to raising an exception.
More information about the XML-SIG