You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by La...@i2.com on 2002/10/14 20:46:00 UTC
FOP/Batik problem with url(#id)
I'm using FOP 0.20.4 to transform SVG into PDF from a jsp page (wrote my
own JSP tag to invoke FOP). The content uses url(#id) in various places
(example below).
<svg:pattern id="sbBgPatt" preserveAspectRatio="xMidYMid meet" width="2"
height="2" patternUnits="userSpaceOnUse" shape-rendering="optimizeSpeed">
<svg:rect x="0" y="0" width="2" height="2" fill="white"/>
<svg:rect x="0" y="0" width="1" height="1" fill="rgb(102,204,255)"/>
<svg:rect x="1" y="1" width="1" height="1" fill="rgb(102,204,255)"/>
</svg:pattern>
<svg:rect fill="url(#sbBgPatt)" height="16" width="716" x="105" y="532"/>
If I execute FOP from a command line, no errors occur. However from
within my JSP environment, I get an exception while it is trying to
process the url. If I remove all usages of url(#id), then everything
works fine.
My question is as follows - Is url(#id) supported at this time and if not,
is there another syntax that is working? I believe FOP 0.20.4 ships with
Batik 1.5beta2.
java.lang.NullPointerException
at java.net.URL.<init>(URL.java:366)
at java.net.URL.<init>(URL.java:329)
at java.net.URL.<init>(URL.java:321)
at java.net.URL.<init>(URL.java:252)
at java.net.URL.<init>(URL.java:275)
at org.apache.batik.util.ParsedURLData.buildURL(Unknown Source)
at org.apache.batik.util.ParsedURLData.openStreamInternal(Unknown
Source)
at org.apache.batik.util.ParsedURLData.openStream(Unknown Source)
at org.apache.batik.util.ParsedURL.openStream(Unknown Source)
at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
Source)
at org.apache.batik.bridge.DocumentLoader.loadDocument(Unknown
Source)
at org.apache.batik.bridge.URIResolver.getNode(Unknown Source)
at org.apache.batik.bridge.URIResolver.getElement(Unknown Source)
at
org.apache.batik.bridge.BridgeContext.getReferencedElement(Unknown Source)
at org.apache.batik.bridge.PaintServer.convertURIPaint(Unknown
Source)
at org.apache.batik.bridge.PaintServer.convertPaint(Unknown
Source)
...
TIA,
Larry Mason
RE: FOP/Batik problem with url(#id)
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "LM" == Larry Mason <La...@i2.com> writes:
LM> I'm using FOP 0.20.4 to transform SVG into PDF from a jsp page
LM> (wrote my own JSP tag to invoke FOP). The content uses url(#id)
LM> in various places (example below).
This bug should be fixed in the current build of Batik 1.5b4
(however I am unsure if the current Batik will work with FOP).
You might be able to 'work around this' by providing an xml:base
attribute (this is tricker than it sounds in general...).
LM> If I execute FOP from a command line, no errors occur. However
LM> from within my JSP environment, I get an exception while it is
LM> trying to process the url. If I remove all usages of url(#id),
LM> then everything works fine.
The problem is that ParseURL didn't deal well with the document
not having an associated URL (in your JSP I assume you you are
building the document from a stream?). You might try providing a
'bogus' URL when you construct the InputStream for the XML parser...
LM> My question is as follows - Is url(#id) supported at this time and
LM> if not, is there another syntax that is working? I believe FOP
LM> 0.20.4 ships with Batik 1.5beta2.
I hope the above at least gives you something to go on.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org