Tue, 16 Jan 2024, /Stanimir Stamenkov/:
EntityResolver
noExternalEntitiesResolver = (publicId, systemId) -> {
return new InputSource(new StringReader(""));
};
xmlReader.setEntityResolver(noExternalEntitiesResolver);
[...]
saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
The latter configuration prohibits any external entities and will fail
the parse operation if an external reference is found...
The former example substitutes all external entities with empty content...
Essentially, configuring "accessExternalDTD" with an empty value is a
convenience for setting up an entity resolver with the following example
implementation:
EntityResolver
noExternalEntitiesResolver = (publicId, systemId) -> {
throw new SAXException("External entity not allowed: " + systemId);
};
--
Stanimir
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org