xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Tošovský <j.tosov...@tiscali.cz>
Subject RE: xml:base
Date Mon, 20 Apr 2009 19:39:34 GMT
> > I've found that Batik has problem with relative paths to external
> Since you are building the document dynamically I'm not sure 
> what 'the same directory' means. 

:-) You are right, of course.
> Setting the base URI via DOM will have almost no impact on 
> performance, I strongly suggest you use that

Are SVGOMDocument.setURLObject and Document.setDocumentURI equivalent? I use
later one to avoid type cast between SVGOMDocument and Document in several
places of the following code:

ByteArrayOutputStream svgStream = new ByteArrayOutputStream();
transformer.transform(new StreamSource(sourceFile), new

if (svgStream != null) {
   DocumentBuilder builder =
   Document svgDocument = builder.parse(new

I am asking as I am getting error during transcoding of following lines:
TranscoderInput input = new TranscoderInput(svgDocument);
t.transcode(input, output);

java.lang.ClassCastException: org.apache.batik.dom.GenericElement cannot be
cast to org.w3c.dom.svg.SVGSVGElement at
) at
coder.java:193) at

But maybe it is caused by svg:svg root element (below is part of
intermediate output)
<?xml version="1.0" encoding="utf-8"?>
<svg:svg xmlns:xs="http://www.w3.org/2001/XMLSchema"
         viewBox="0 0 148.5 105">

Can be this error fixed somehow?

> > 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
> you want, but probably some sort of error document (404, etc). 

I only call Batik transcoder. The same result I am getting with Squiggle. I
don't know what they are trying to retrive from there. In svg file there is
link to JPEG file, but this file is at this URL
(http://localhost:8080/myApp/ + 'sunset.jpeg'). The second link is internal
link to #grey-filter.
I only found now that if there is placed svg file beside jpeg, Tomcat give
404 error if I try to display it in a browser. Strange. But maybe some kind
of security.

If there is used valid URI with file protocol:
I get error "Content is not allowed in prolog." (the same result also with 3
or 4 slashes).
If xml:base="file://C:/Progra..." (double slashes) are used, processing
takes much longer, but in result I get error "C".


To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message