Re: [Sax-devel] Re: RFE #434478 (SAX2 and resolving system IDs)
Brought to you by:
dmegginson
From: David B. <da...@pa...> - 2001-11-08 19:59:20
|
> I thought perhaps you were right so I tried 1.4.3 - but got the same answer. > To clarify, calling Locator.getSystemId() from within > EntityResolver.resolveEntity() returns the value of systemId as passed to > resolveEntity(). > > This isn't strictly a bug. The SAX spec reads "Note that the results > returned by the [Locator] will be valid only during the scope of each > content handler method: the application will receive unpredictable results > if it attempts to use the locator at any other time". As the > EntityResolver.resolveEntity() isn't a 'content handler' method, the results > are undefined. I think that text is wrong; it should say "callback method" rather than "content handler" method. Locator itself is "for associating a SAX event with a document location", and there are more events than just content handler callbacks. (But very early on, there weren't...) > > Do you have suggestions about how to tighten up the spec there? > > I'm not sure that changing the spec is appropriate in this case. As I > understand it, the Locator was created to allow applications to report > meaningful parsing messages to end users. This is a similar but *different* > requirement to returning a base URI to the application. I don't see that. The base URI is the base URI, whether it appears in diagnostics or anywhere else. Diagnostics from resolveEntity() can throw a SAXParseException, and the best of those are built using a Locator ... And anyway, _one_ of the original uses of Locator wasn't the only reason for that interface to exist ... :) - Dave |