Oleg Tkachenko wrote:
David Mechner wrote:
On advice received here, I'm trying to use CatalogResolver to make my
program access a local SVG dtd instead of a remote one at w3.org.
I've gotten as far as getting xalan to use the resolver, but it seems
that the problem (well, the behavior I want to change, anyway) is in
the next step; in FOP. But I can't see how to get FOP to use my
FOP works on tree level and has nothing to do with dtd handling, that's
completely duty of xml parser. I believe all you have to do is to set up
com.sun.resolver.tools.CatalogResolver as entity resolver using
setEntityResolver method of XMLReader class before parsing your fo/xsl/xml.
The original poster had his FO already in a DOM tree, so I think
the problem is with SVG imported via fo:external-graphics.
The relevant code here appears to be in image/analyser/SSVGReader.java:
SAXSVGDocumentFactory factory =
SVGDocument doc = factory.createDocument(uri, imageStream);
The habit of passing class name around just sucks, but then, its
probably legacy from ancient times when there were not standard APIs.
The SAXSVGDocumentFactory is imported from Batik. I have no idea
whether there are hooks in Batik so that the parser can be configured
before the SVG is parsed. (FOP fortunately has the render(parser,inputSource),
where you can pass a configured parser).
There ought to be a possibility to tell FOP "use this parser factory
for creating all parsers you need" as part of the configuration.
Some Batik guru out there? I'm too lazy to check for myself right now, its
weekend and all that... :)