You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by David Mechner <fo...@mechner.com> on 2002/10/24 19:21:04 UTC

http get to w3.org?

Hi,

I'm using Xalan/Xerces/FOP/Batik to generate PDF reports including SVG
graphics. I noticed that each time a report is generated, at some
point in the process an http connection to w3.org is made. For some
reason I think it's to retrieve the svg .dtd, but I'm not sure.
Anyway, I'm generating several thousand documents and I'd like to
cache this locally if I could - both for efficiency and because I
don't want to depend on the internet for my file generation.

My apologies if it isn't FOP that's doing this - it's hard for me to
tell - but any help would be greatly appreciated.

Thanks,
-David


Re[2]: http get to w3.org?

Posted by David Mechner <fo...@mechner.com>.
Thanks for the response.

I decided your first suggestion looks by far the simplest.

>From my reading of the batik docs the following is supposed
to do the trick:

DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
String svgNS = "file:///c:/gra/svg10.dtd";
Document doc = impl.createDocument(svgNS, "svg", null);

(instead of createDocument(null, "svg", null))

However, supplying the local file svgNS URI seems to have no effect on
the generated svg doc.

It still starts out:

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>

Am I misunderstanding?

Thanks,
-David


You wrote:
OT> David Mechner wrote:

>> I'm using Xalan/Xerces/FOP/Batik to generate PDF reports including SVG
>> graphics. I noticed that each time a report is generated, at some
>> point in the process an http connection to w3.org is made. For some
>> reason I think it's to retrieve the svg .dtd, but I'm not sure.

OT> Well, it could be dtd. By default parsers load the DTD and use it to add 
OT> default attributes and set attribute types, so probably that's the case.
OT> Your options:
OT> o change uri to a local copy of the dtd
OT> o turn off dtd loading in your parser (e.g. 
OT> http://apache.org/xml/features/nonvalidating/load-dtd-grammar feature if you 
OT> are using xerces)
OT> o use XML Catalog + Norm Walsh's URIResolvers to redirect parser to a local 
OT> resource.


Re: http get to w3.org?

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Oleg Tkachenko wrote:
>> Better yet, copy the namespace declaration into your SVG
>> and delete the DOCTYPE completely.
> 
> Well, you one is able to do that, but if not - using OASIS XML Catalogs 
> could be extremely handy in such a situation. I learned that developing 
> some stuff using docbook website dtd: along with the same dtd loading 
> problem (you know, docbook dtd is not a small fry) there was a jazz like
> <xsl:import 
> href="http://docbook.sourceforge.net/release/xsl/current/html/chunker.xsl"/>, 
> so then Norm and others at docbook-apps pointed me out "the right way" - 
> XML Entity and URI Resolvers 
> http://wwws.sun.com/software/xml/developers/resolver/article.
> 
Well, the SVG DTD is not small either, and not really necessary
for processing SVG, except for the namespace attribute (duh!).
Certainly not an issue for casual processing, but I'd delete the
DTD reference for heavy duty service, it takes some non-trivial
amount of time just to load the file even from a local disc.


J.Pietschmann


Re: http get to w3.org?

Posted by Oleg Tkachenko <ol...@multiconn.com>.
J.Pietschmann wrote:

>> o turn off dtd loading in your parser (e.g. 
>> http://apache.org/xml/features/nonvalidating/load-dtd-grammar feature 
>> if you are using xerces)
> 
> Not recommended, because the SVG DTD has the nasty habit
> of defining the SVG namespace as an attribute to the svg
> element.
> 
> Better yet, copy the namespace declaration into your SVG
> and delete the DOCTYPE completely.
Well, you one is able to do that, but if not - using OASIS XML Catalogs 
could be extremely handy in such a situation. I learned that developing 
some stuff using docbook website dtd: along with the same dtd loading 
problem (you know, docbook dtd is not a small fry) there was a jazz like
<xsl:import 
href="http://docbook.sourceforge.net/release/xsl/current/html/chunker.xsl"/>, 
so then Norm and others at docbook-apps pointed me out "the right way" - 
XML Entity and URI Resolvers 
http://wwws.sun.com/software/xml/developers/resolver/article.

-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel


Re: http get to w3.org?

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Oleg Tkachenko wrote:
> o turn off dtd loading in your parser (e.g. 
> http://apache.org/xml/features/nonvalidating/load-dtd-grammar feature if 
> you are using xerces)
Not recommended, because the SVG DTD has the nasty habit
of defining the SVG namespace as an attribute to the svg
element.

Better yet, copy the namespace declaration into your SVG
and delete the DOCTYPE completely.

J.Pietschmann



Re: http get to w3.org?

Posted by Oleg Tkachenko <ol...@multiconn.com>.
David Mechner wrote:

> I'm using Xalan/Xerces/FOP/Batik to generate PDF reports including SVG
> graphics. I noticed that each time a report is generated, at some
> point in the process an http connection to w3.org is made. For some
> reason I think it's to retrieve the svg .dtd, but I'm not sure.

Well, it could be dtd. By default parsers load the DTD and use it to add 
default attributes and set attribute types, so probably that's the case.
Your options:
o change uri to a local copy of the dtd
o turn off dtd loading in your parser (e.g. 
http://apache.org/xml/features/nonvalidating/load-dtd-grammar feature if you 
are using xerces)
o use XML Catalog + Norm Walsh's URIResolvers to redirect parser to a local 
resource.

-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel


Re: http get to w3.org?

Posted by Christian Wolfgang Hujer <Ch...@itcqis.com>.
Hello David,

Am Donnerstag, 24. Oktober 2002 19:21 schrieb David Mechner:
> I'm using Xalan/Xerces/FOP/Batik to generate PDF reports including SVG
> graphics. I noticed that each time a report is generated, at some
> point in the process an http connection to w3.org is made. For some
> reason I think it's to retrieve the svg .dtd, but I'm not sure.
> Anyway, I'm generating several thousand documents and I'd like to
> cache this locally if I could - both for efficiency and because I
> don't want to depend on the internet for my file generation.
>
> My apologies if it isn't FOP that's doing this - it's hard for me to
> tell - but any help would be greatly appreciated.

it is neccessary for proper XML processing to sometimes load the DTD since it 
has to be considered "part" of the document.
Probably it is all four programs: Xalan, Xerces, FOP and Batik, which want to 
retreive the DTD.
This also depends on the "isValidating"-setting of the XML software.

If you use Ant, you might want to use its XML Catalog feature, which allows to 
define a mapping between public ids and alternate system ids of external 
parsed entities to have those looked up on your local file system instead of 
retreiving them via HTTP (repeatedly).
And the external subset of the documenttype definition, e.g. svg.dtd, is such 
an external parsed entity.

Otherwise you might wnt to look for an alternative URIResolver.

Bye

-- 
ITCQIS GmbH
Christian Wolfgang Hujer
Geschäftsführender Gesellschafter
Telefon:+49  (0)89  27 37 04 37
Telefax:+49  (0)89  27 37 04 39
E-Mail:Christian.Hujer@itcqis.com
WWW: http://www.itcqis.com/