<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<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/">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">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">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">https://www.renderx.com/reference.html#using_catalogs_for_docbook</a><br>
</p>
<p></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">"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">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">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">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">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>
</body>
</html>