<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Great stuff, Vladyslav and Ken. Thanks for the info. XML Catalogs
    have become kind of an arcane knowledge, and I have recorded all
    this for future inquires.<br>
    <br>
    Mark<br>
    <br>
    <div class="moz-cite-prefix">On 10/24/2023 4:22 AM, Vladyslav
      Sivyakov wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:13e74b88-b996-acaf-69c4-2ca0736763da@renderx.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Hello Gerd,</p>
      <p>XML Catalogs seems to be a good tool for this task.</p>
      <p>In a simplest case, it can be used to rewrite network URI (http
        to https). But there's more; you can download the DTD in
        question (and any other resource) locally so that XEP used it
        instead of doing so via a slow and unreliable network
        connection. It also has a fallback logic so that if no local
        resource found, it would go online for retrieving it.</p>
      <p>What you need is:</p>
      <ol>
        <li>Download <font face="monospace">xml-commons-resolver-1.2.zip</font>  
          from the Apache Web site: <a class="moz-txt-link-freetext"
            href="https://dlcdn.apache.org//xerces/xml-commons/"
            moz-do-not-send="true">https://dlcdn.apache.org//xerces/xml-commons/</a></li>
        <li>Extract  <code class="filename">resolver.jar </code> into
          a directory listed in CLASSPATH;</li>
        <li>Download <font face="monospace">svg11.dtd</font> (and any
          other resources you need) locally;<br>
        </li>
        <li>Write a <code class="filename">.cat </code>file to
          configure XML Catalog to point to your locally-stored
          resources;<br>
        </li>
        <li>Invoke XEP with two additional parameters. Here's how to do
          it in command-line:<code class="filename"><br>
            java<br>
-Dcom.renderx.sax.entityresolver=org.apache.xml.resolver.tools.CatalogResolver<br>
-Dcom.renderx.jaxp.uriresolver=org.apache.xml.resolver.tools.CatalogResolver<br>
            com.renderx.xep.XSLDriver<br>
            ...<br>
          </code><code class="filename"></code></li>
      </ol>
      <p>A good reading would be this article: <a
          class="moz-txt-link-freetext"
          href="http://www.sagehill.net/docbookxsl/Catalogs.html"
          moz-do-not-send="true">http://www.sagehill.net/docbookxsl/Catalogs.html</a></p>
      <p>For further details, refer "XML Entity and URI Resolvers" by
        Norman Walsh:
        <a class="moz-txt-link-freetext"
href="https://xerces.apache.org/xml-commons/components/resolver/resolver-article.html"
          moz-do-not-send="true">https://xerces.apache.org/xml-commons/components/resolver/resolver-article.html</a><br>
      </p>
      <p>XEP User Guide also has a section describing how one could use
        XML Catalog for a similar purpose, caching DocBook stylesheets:
        <a class="moz-txt-link-freetext"
href="https://www.renderx.com/reference.html#using_catalogs_for_docbook"
          moz-do-not-send="true">https://www.renderx.com/reference.html#using_catalogs_for_docbook</a><br>
      </p>
      <pre class="moz-signature" cols="72">Best regards,
Vladyslav Sivyakov, RenderX.</pre>
      <div class="moz-cite-prefix">On 24.10.2023 11:09, Gerd v. Egidy
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:4877035.31r3eYUQgx@blackbird.m.i2n">
        <pre class="moz-quote-pre" wrap="">Hi,

I include some svg files into my fo file like this:

<fo:external-graphic width="auto" height="auto" content-width="36pt" 
src="url(images/admon/caution.svg)" />

This svg file contains a doctype with a external URL to the DTD:

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" <a
        class="moz-txt-link-rfc2396E"
        href="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"
        moz-do-not-send="true">"http://www.w3.org/Graphics/
SVG/1.1/DTD/svg11.dtd"</a>>

This results in XEP downloading this DTD file every time such a SVG is 
included.

Recently W3C implemented two changes on their server: they automatically 
redirect to HTTPS and they have implemented a limit how often you can download 
a file in short succession. When they still used HTTP my local proxy server was 
able to serve the dtd from cache after the first download.

My fo contains hundreds of such SVG files, causing hundred of downloads to this 
file. After the first few I get this:

        [error] Failed to create image <a class="moz-txt-link-freetext"
        href="file:./images/admon/caution.svg" moz-do-not-send="true">file:./images/admon/caution.svg</a> of type 
null
        [error] com.renderx.graphics.ImageFormatException: 
org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 100; Cannot read 
from <a class="moz-txt-link-freetext"
        href="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"
        moz-do-not-send="true">http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd</a> (Server returned HTTP 
response code: 429 for URL: <a class="moz-txt-link-freetext"
        href="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"
        moz-do-not-send="true">http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd</a>)

Is there a way to tell XEP not to download the DTDs or can I redirect them, so 
that they are loaded from some local cache directory on my disk?

Thanks.

Kind regards,

Gerd




_______________________________________________
(*) To unsubscribe, please visit <a class="moz-txt-link-freetext"
        href="http://lists.renderx.com/mailman/options/xep-support"
        moz-do-not-send="true">http://lists.renderx.com/mailman/options/xep-support</a>
(*) By using the Service, you expressly agree to these Terms of Service <a
        class="moz-txt-link-freetext" href="http://w"
        moz-do-not-send="true">http://w</a>
ww.renderx.com/terms-of-service.html
</pre>
      </blockquote>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
(*) To unsubscribe, please visit <a class="moz-txt-link-freetext" href="http://lists.renderx.com/mailman/options/xep-support">http://lists.renderx.com/mailman/options/xep-support</a>
(*) By using the Service, you expressly agree to these Terms of Service <a class="moz-txt-link-freetext" href="http://w">http://w</a>
ww.renderx.com/terms-of-service.html</pre>
    </blockquote>
    <br>
  </body>
</html>