tags:

views:

32

answers:

1

I wrote a custom resolver class. It works OK for resolving SYSTEM DTDs, but not for resolving PUBLIC DTDs. When the class has to resolve PUBLIC DTDs instead of the URI of the resource, the function receives the public identifier through the absoluteUri parameter of the GetEntity function. Is there a solution to this.

In examples:

  • if I have a DTD declaration like <!DOCTYPE document SYSTEM "document.dtd"> then the custom resolver correctly receives the string "document.dtd" through the absoluteUri parameter of the GetEntity function.
  • if I have a DTD declaration like <!DOCTYPE document PUBLIC "-//Organization//DTD Document 1.0//EN" "http://localhost/document.dtd"&gt; then the custom resolver incorrectly receives the string "-//Organization//DTD Document 1.0//EN" instead of "scheme://host/document.dtd".
A: 

I have found the answer right here on Stack Overflow. First the public identifier (-//Organization//DTD Document 1.0//EN) is passed as parameter, than - if the first call resulted in an error - the uri of the DTD file (http://localhost/document.dtd).

Pok