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
"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.unparsedEntityDecl(), and
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?
XML Parser Development
IBM Toronto Lab