[
Lists Home |
Date Index |
Thread Index
]
Kirk Allen Evans wrote:
>endDocument should only be raised after exception if the rest of the
>document continues to be parsed after exception.
>
><?xml version="1.0" encoding="UTF-8"?>
><root>
> <foo/>
> <foo>&bar;</foo>
> <foo/>
> <foo/>
></root>
>
>The entity "bar" is not declared here. If you are parsing this document,
>how many times do you expect startElement to be invoked? If you argue it
>raised three times, then endDocument should not be invoked because you imply
>that you reached the end of the document when you did not. You should only
>invoke endDocument when you actually parse the end of the document.
>
>Kirk
>
>
>
I'll vote with Kirk, Jochen, Karl, and others on this one. From a
principle of least surprise standpoint, I don't see the sense in
endDocument() being called when the document has not been fully
processed. I think it should only be called upon successful completion
of the parse.
As for filters and handlers, they should always initialize their state
on startDocument(). That will prevent any errors due to reuse after
attempting to parse a bad document.
- Dennis
|