Bug #279
closedentity resolver sometimes fails
0%
Description
The DBEntityResolver is used durning XML document parsing to find the locations
of the DTDs to be used to validate a document. The current entity resolver
works for the DOCTYPE entity and properly finds the proper dtd from the metacat
dtd directory. However, when that dtd references another using an external
entity, that secondary included DTD is not resolved. This is becuase the entity
resolver takes a very document centric view of what it should do, and needs to
be fixed to resolve all entities.
External entities generally use a relative SYSTEM id of the form:
<!ENTITY % resource SYSTEM "./eml-resource-2.0.dtd">
This system id needs to be interpreted and mapped to a file that is stored in
the metacat dtd directory. Because the system ID can be relative, we need to
register both the public ID and the relative system IDs (possibly two or more
forms ("eml-resource.dtd", and "./eml-resource.dtd") for mapping to the true
file location.
In addition, the Entity resolver class depends on DBSAXHandler to find the
public ID. This may be an obsolete requirement based on older, buggy xerces
parsers. We need to update Xerces and see if we still need this sax handler
reference to make the resolver work correctly. Theoretically at least all of
the needed info should be contained inthe "resolveEntity(String publicID, String
systemID)" call that is made to the resolver. If the sax handler is no logner
needed for proper resolution, we should eliminate it to simplify the
DBEntityResolver class.
Updated by Jivka Bojilova over 23 years ago
FIXED
resolving external entities included in the DTD is enabled;
external entities are now resolved successfully by DBEntityResolver using the
specified system ids
and thus there no need of registering the relative system ids,
This is because EntityResolver uses its internal implementation to map the
relative system ids to the
files on the current file system; for example external entity declared in the
DTD as:
<!ENTITY % resource SYSTEM "./eml-resource.dtd">
is resolved to "file:///opt/tomcat/webapps/bojilova/dtd/eml-resource.dtd"
which is the right location of eml-resource.dtd file.