« Return to Thread: fop error fetching DTDs (being blocked, can I look locally instead)

Re: fop error fetching DTDs (being blocked, can I look locally instead)

by cbowditch :: Rate this Message:

Reply to Author | View in Thread

Hayden Stainsby wrote:
> Hi everyone,
>
> I've recently had an error with a process involving fop, upon running  
> fop java throws an exception and quits, every time The exception is:
>
> javax.xml.transform.TransformerException: java.io.IOException: Server  
> returned HTTP response code: 503 for URL:
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

Yes I recently ran into the same problem and the reason you state is
exactly correct.

>
> The next two paragraphs are the reason and the workaround, my question  
> is below.
>
> After a bit of hunting around, it looks like the folk at W3C are  
> deliberately blocking access to clients making lots of requests for  
> various DTDs since their servers are being heavily loaded serving the  
> same file to the same people over and over. This does make a lot of  sense.
>
> My work around was to hack my /etc/hosts file to point www.w3.org back  
> at the local machine where I've got copies of all the DTDs that I need  
> (xhtml-lat1.ent, xhtml-symbol.ent, xhtml-special.ent, and xhtml1-
> strict.dtd). Now fop thinks it's fetching the DTDs, but it's actually  
> looking at a local apache instance rather than ww3.org and everyone is  
> happy.

I've used a similar hack in the past, but it is a hack and not portable.

>
> ---- THE QUESTION ----
> My question is, is there a way to prevent fop from fetching DTDs but  
> instead look first for a local copy. I mean let's face it, the xhtml1-
> strict spec probably isn't going to change any time soon, I'd be just  
> as happy to keep the file locally. I couldn't find anything in the  
> archives or online regarding this, but I only use fop infrequently so  I
> may be looking in the wrong place.

First of all its not FOP looking for the DTDs but the XML Parser in use
on your system. The XML Parser is looking for the DTD because you asked
it to parse some XML with a reference to the DTD. There are 2 possible
solutions:

1) remove the reference to the DTD in the XML if you can live without it
2) Setup XML Catalogs. If you are using Xerces then this is described
here: http://xerces.apache.org/xerces2-j/faq-xcatalogs.html. Please note
this is a little off topic for this list.

>
> Thanks for your time and any help you may be able to give.

Regards,

Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@...
For additional commands, e-mail: fop-users-help@...

 « Return to Thread: fop error fetching DTDs (being blocked, can I look locally instead)