Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Duplicate
-
2.5.0, 2.6.0
-
None
-
None
-
Linux - but defect found at source code level...
Description
XercesDOMParser doesn't in 1 of 2 cases call an installed XMLEntityResolver. In both cases it calls a normal EntityResolver (so the short-term workaround is to use a normal resolver, but then you don't get all the XML info).
The code from XercesDOMParser is below. Basically for the first function it does not call fXMLEntityResolver if it has one, it only checks for fEntityResolve. In the second case it checks for both (though it appears doing a parser->parse(file) with this object always results in the first one being called, thus the XMLEntityParser is never used).
Related: XERCESC-1151 refers to a derivative class doing something wrong in these regards. XERCESC-1204 (duplicate of XERCES-1151) has a copy of the exact code below, but also speaks about a derived class only.
InputSource*
XercesDOMParser::resolveEntity(const XMLCh* const publicId,
const XMLCh* const systemId,
const XMLCh* const)
{
//
// Just map it to the SAX entity resolver. If there is not one installed,
// return a null pointer to cause the default resolution.
//
if (fEntityResolver)
return fEntityResolver->resolveEntity(publicId, systemId);
return 0;
}
InputSource*
XercesDOMParser::resolveEntity(XMLResourceIdentifier* resourceIdentifier)
{
//
// Just map it to the SAX entity resolver. If there is not one installed,
// return a null pointer to cause the default resolution.
//
if (fEntityResolver)
return fEntityResolver->resolveEntity(resourceIdentifier->getPublicId(),
resourceIdentifier->getSystemId());
if (fXMLEntityResolver)
return fXMLEntityResolver->resolveEntity(resourceIdentifier);
return 0;
}