xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Marcy <gma...@us.ibm.com>
Subject Re: Error recovery while parsing XMLs ..
Date Wed, 16 Apr 2003 14:17:21 GMT
> For the input:
> 
> <icon >
>     <small-icon>stillTypingMygif
>     <large-icon>/tmp/large.gif</large-icon>
> </icon>
> 
>> By the time the parser realizes that there is a fatal error, it 
should've
>> already reached </icon>. It can't go back and add </small-icon> before
>> <large-icon>. (Because, for SAX, the events for <large-icon> have 
already
>> been sent to the application.)

>I think the point he wanted to make was that the events for <large-icon>
>should not even be sent at all because at that point you would be able
>to know that small-icon cannot contain large-icon. Wether this would be
>better or worse I cannot say.

Xerces only checks DTD content models when it encounters element end tags.
So in the example given, it doesn't see an end tag until </large-icon> and
it sees that the content of that element is okay.  As Sandy points out, it
is only when it sees the </icon> tag that it is in a position to take some
*corrective* action, which at that point is too late.

Even if Xerces were changed to check content models on the way *down the
tree*, just how much do you think we should be prepared to buffer just to
handle an error condition?  Most people seem to like having their *good*
documents processed quickly and I doubt they would want us spending many
of their cycles imagining what we could be doing to make reporting errors
in the bad ones more helpful.

Anyway, just my 2 cents worth...

-Glenn

Mime
View raw message