Hello Gerd,
XML Catalogs seems to be a good tool for this task.
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.
What you need is:
1. Download xml-commons-resolver-1.2.zip from the Apache Web site:
https://dlcdn.apache.org//xerces/xml-commons/
2. Extract |resolver.jar | into a directory listed in CLASSPATH;
3. Download svg11.dtd (and any other resources you need) locally;
4. Write a |.cat |file to configure XML Catalog to point to your
locally-stored resources;
5. Invoke XEP with two additional parameters. Here's how to do it in
command-line:|
java
-Dcom.renderx.sax.entityresolver=org.apache.xml.resolver.tools.CatalogResolver
-Dcom.renderx.jaxp.uriresolver=org.apache.xml.resolver.tools.CatalogResolver
com.renderx.xep.XSLDriver
...
|||
A good reading would be this article:
http://www.sagehill.net/docbookxsl/Catalogs.html
For further details, refer "XML Entity and URI Resolvers" by Norman
Walsh:
https://xerces.apache.org/xml-commons/components/resolver/resolver-article.html
XEP User Guide also has a section describing how one could use XML
Catalog for a similar purpose, caching DocBook stylesheets:
https://www.renderx.com/reference.html#using_catalogs_for_docbook
Best regards,
Vladyslav Sivyakov, RenderX.
On 24.10.2023 11:09, Gerd v. Egidy wrote:
> 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""http://www.w3.org/Graphics/ SVG/1.1/DTD/svg11.dtd">
>
> 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 imagefile:./images/admon/caution.svg of type
> null
> [error] com.renderx.graphics.ImageFormatException:
> org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 100; Cannot read
> fromhttp://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd (Server returned HTTP
> response code: 429 for URL:http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd)
>
> 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 visithttp://lists.renderx.com/mailman/options/xep-support
> (*) By using the Service, you expressly agree to these Terms of Servicehttp://w
> ww.renderx.com/terms-of-service.html
_______________________________________________
(*) To unsubscribe, please visit http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service http://w
ww.renderx.com/terms-of-service.html
Received on Tue Oct 24 04:04:23 2023
This archive was generated by hypermail 2.1.8 : Tue Oct 24 2023 - 04:04:28 PDT