Lists Home |
Date Index |
Elliotte Rusty Harold wrote:
> I don't think this is a change. I think this is what the specs say now,
> and I think those parsers are today non-conformant. This would make it
> more obvious to parser vendors that they have a problem and that they
> need to call endDocument. Right now they're living in denial.
Well, as others have pointed out in early threads, it's a bit ambiguous.
Looking over the current documentation on saxproject.org, I see that
ContentHandler.endDocument says this:
The SAX parser will invoke this method only once, and it will be the
last method invoked during the parse. The parser shall not invoke this
method until it has either abandoned parsing (because of an unrecoverable
error) or reached the end of input.
while ErrorHandler.fatalError says this:
The application must assume that the document is unusable after the parser
has invoked this method, and should continue (if at all) only for the sake
of collecting additional error messages: in fact, SAX parsers are free to
stop reporting any other events once this method has been invoked.
On balance, I'd say that the current docs tilt towards making endDocument
optional, but it's definitely not clean. The text for endDocument() seems
to assume that the method will always be called, but it never explicitly
says that it *must* be; on the other hand, the text for fatalError()
explicitly states that it does not have to be.
It would be nice to see this fixed in a major release in the future; for
now, the best solution is probably just to add some text stating that it's
optional for now, but might change in the future -- at least that will
clarify the situation for people using SAX parsers.
> However, before making this change we should probably ask the relevant
> Xerces and Oracle developers what they think. AS far as I can tell,
> these are the only two currently maintained SAX parsers for Java, and
> both have this problem. (At least Oracle 9 did. I haven't tested the
> just released Oracle 10 yet.)
That would be a good thing to do for a bigger, fancier release. This is
going to be a small one.
All the best,