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