Bug #5605
closedPrefer to prioritize the XML reader's entity resolver
0%
Description
In the net.sf.saxon.Configuration class in the two places where the ChainedResourceResolver is created, it should add the xml reader's entity resolver as the first resolver in the chain, otherwise the other resolver has the habit of returning a source even if it cannot resolve the reference and the xml reader's entity resolver would never get called. In the class ChainedEntityResolver on the net.sf.saxon.lib.ChainedEntityResolver.resolveEntity(String, String, String, String) method if the "first" and "second" are not EntityResolver2, but plain EntityResolver you could fallback to the EntityResolver API like:
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException {
InputSource is = null;
if (first instanceof EntityResolver2) {
is = ((EntityResolver2) first).resolveEntity(name, publicId, baseURI, systemId);
} else {
is = first.resolveEntity(publicId, systemId);
}
if (is == null) {
if(second instanceof EntityResolver2) {
is = ((EntityResolver2) second).resolveEntity(name, publicId, baseURI, systemId);
} else {
is = second.resolveEntity(publicId, systemId);
}
}
return is;
}
Updated by Michael Kay over 2 years ago
- Category set to Internals
- Status changed from New to In Progress
- Assignee set to Michael Kay
- Applies to branch 11, trunk added
- Fix Committed on Branch 11, trunk added
- Platforms Java added
I've implemented the suggestion of changing ChainedEntityResolver
so it can fall back to using the plain EntityResolver
interface.
I'm less comfortable with changing the order of resolvers. This seems to be related to bug #5582 and I think it needs more careful consideration of use cases.
Updated by Norm Tovey-Walsh about 1 year ago
- Status changed from In Progress to Won't fix
Changing the order of the resolvers is likely to be much too disruptive.
Please register to edit this issue