xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: xml:base
Date Mon, 20 Apr 2009 10:52:08 GMT
Hi Jan,

Jan To?ovsk√Ĺ <j.tosovsky@tiscali.cz> wrote on 04/18/2009 03:50:07 PM:

> I've found that Batik has problem with relative paths to external 
> Even if they are placed in the same directory and referenced by the
> following code, they are hidden to Batik:

   Since you are building the document dynamically I'm not sure
what 'the same directory' means.

> I think it would have impact on performace to try to set base URI via 
> DOM (several extra lines of code) so I am trying to add xml:base 
> attribute directly into SVG files.

   Setting the base URI via DOM will have almost no impact on
performance, I strongly suggest you use that (a few extra lines
of code in your function is nothing compared to the thousands 
of lines of code that run when you do the transcode).

> This is quite nightmare as using xml:base in the following form 
> I am getting the exceptions below: 
> 1) http://localhost:8080/myApp 
> org.apache.batik.bridge.BridgeException: The declaration for the entity
> "HTML.Version" must end with '>'.

   The reference to HTML makes me think that the http server isn't
sending what you want, but probably some sort of error document (404, 

> I have no idea how to set it properly. Is there possibility to use 
> path? 
> It can be built using String path = getServletContext().getRealPath(""); 

> so it could be automated somehow. 

    Yes, you just need to use a 'file:' URL.  The easiest way to get one
is to construct a 'File' object (from your string) and then call 

> In case of URL it must be hardcoded only I think. Additionally there is 
a risk
> it will have to be edited after a change of the URL.

    No anything you can set as 'xml:base' you can set as baseURL.

> BTW, for my purpose the best solution would be addition of new 
> hint which would be set on the fly - no processing DOM or placing 
> attribute into SVG document. The path is known in the transforming step 
> it can be easily used...

   It's an interesting idea but really adds no value over just setting 
DOM base URL.

View raw message