I've written a class extending XmlUrlResolver to resolve references to public identifiers in XML documents. For example, when an XML document starts with:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE chapter PUBLIC "-//Custom//EN" "custom.dtd">
The public identifier "-//Custom/EN" is passed to the relativeURI
parameter of my overriden ResolveUri()
method, and resolved to the actual DTD location on disk. That works correctly.
The problem occurs when there is an entity reference inside the DTD itself. For example:
<!ENTITY % tablemodel
PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN"
"soextblx.dtd">
In this case, the system identifier "soextblx.dtd" is passed to ResolveUri()
instead of the public identifier "-//OASIS//DTD XML Exchange Table Model 19990315//EN".
Is there any way to accomplish this? Overriding GetEntity()
does not seem to work, either, because it is also passed the system identifier.