SAX2 Extensions 1.1: issue with resolve-dtd-uris feature

Michael Glavassevich <[email protected]> Thu, 11 Mar 2004 10:50:47 -0500
Newsgroups gmane.text.xml.sax.devel
Message-ID <OFC70933F9.8A764F69-ON85256E54.00541E3E-85256E54.0056FD1C@ca.ibm.com>
The 1.1 extensions add a new feature called resolve-dtd-uris which 
determines whether system IDs reported in DTDHandler and DeclHandler are 
resolved against a base URI.

From the package description (in CVS) for org.xml.sax, it says this about 
resolve-dtd-uris:

"A value of "true" indicates that system IDs in declarations will be 
absolutized (relative to their base URIs) before reporting. (That is the 
default behavior for all SAX2 XML parsers.) A value of "false" indicates 
those IDs will not be absolutized; parsers will provide the base URI from 
Locator.getSystemId(). This applies to system IDs passed in 
  - DTDHandler.notationDecl(), 
  - DTDHandler.unparsedEntityDecl(), and 
  - DeclHandler.externalEntityDecl(). 
It does not apply to EntityResolver.resolveEntity(), which is not used to 
report declarations, or to LexicalHandler.startDTD(), which already 
provides the non-absolutized URI."

This default behaviour is fine for DTDHandler. The javadoc for both 
DTDHandler.notationDecl() and DTDHandler.unparsedEntityDecl() says that: "
If the system identifier is a URL, the parser must resolve it fully before 
passing it to the application." However the javadoc for 
DeclHandler.externalEntityDecl() says nothing of the sort. It specifies 
that the systemId parameter is: "the declared system identifier of the 
entity". I would interpret that to be the literal system identifier as it 
was specified in the document, not the result of resolving this against a 
base URI. The description for LexicalHandler.startDTD() (which isn't 
affected by this feature) is similar. It says that the systemId parameter 
is: "The declared system identifier for the external DTD subset, or null 
if none was declared".

There's an inconsistency here which should be resolved. Was it always 
intended that the systemId passed to DeclHandler.externalEntityDecl() be 
fully resolved, even though the text doesn't seem to imply that? If not, 
why are system IDs passed to this method affected by this feature?

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [email protected]
E-mail: [email protected]