I'm really confused by this problem and would appreciate any opinions!

I've simplified my issue down to Cocoon/Batik throwing an error on specific styles of SVG documents if and only if a stylesheet is applied to the document. Interestingly, once a single SVG document is processed w/o error by SVGSerializer all SVG documents (including ones that failed previously) are processed w/o error. I'm guessing SVGBuilder.setDocumentLocator() is called in the success case and once it is called the serializer works correctly for all SVG documents.

Under 2.04 these documents/stylesheets worked w/o errors.

The type of document is exactly like the sample batikLogo.svg (my example is shown below).

My test stylesheet (seems ok to me?? or do I need additional processing-instructions/output method??) copy.xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<!-- copy everything to output -->
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>


Test pipelines:
<!-- this will fail UNTIL after you request successSVG -->
<!-- from then on this will succeed -->
<map:match pattern="failSVG">
   <map:generate src="test.xml" />
   <!-- copy input to output -->
   <map:transform src="copy.xsl"/>
   <map:serialize type="svg2png"/>
</map:match>

<!-- also fails everytime until passSVG is requested -->
<map:match pattern="failBatik">
   <map:generate src="batikLogo.svg" />
   <!-- copy input to output -->
   <map:transform src="copy.xsl"/>
   <map:serialize type="svg2png"/>
</map:match>

<map:match pattern="passSVG">
   <map:generate src="test.xml" />
   <map:serialize type="svg2png"/>
</map:match>

As I mention below it seems the error provided by SVGBuilder.endDocument():
"setDocumentLocator was not called, URI resolution will not work" is the likely cause of the problem. I just don't know to resolve it!


Thanks for your help
Steve

Hi
I switched this week from 2.0.4 to 2.1rc2 and svg2png is now throwing on my SVG documents with this error:


DEBUG (2003-08-11) 23:36.50:858 [sitemap.generator.file] (/~sschwarz/assets/images/SwayBridge_93.png) PoolThread-3/FileGenerator: file resolved to file:/home/sschwarz/websites/agilitycourses/assets/images/src/SwayBridge.xml
WARN (2003-08-11) 23:36.50:889 [sitemap.serializer.svg2png] (/~sschwarz/assets/images/SwayBridge_93.png) PoolThread-3/SVGBuilder: setDocumentLocator was not called, URI resolution will not work
DEBUG (2003-08-11) 23:36.50:899 [sitemap.serializer.svg2png] (/~sschwarz/assets/images/SwayBridge_93.png) PoolThread-3/SVGSerializer: Got transcoder exception writing image, rethrowing nested exception
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
null:-1
An I/O error occured while processing the URI '#slats' specified on the element <use>
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
at org.apache.cocoon.serialization.SVGSerializer.notify(SVGSerializer.java:232)
at org.apache.cocoon.xml.dom.SVGBuilder.endDocument(SVGBuilder.java:162)
at org.apache.xml.serializer.ToXMLSAXHandler.endDocument(ToXMLSAXHandler.java:222)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1274)



I'm wondering specifically about:
"setDocumentLocator was not called, URI resolution will not work" which might indicate why the only docs that fail are those that contain internal xlinks??


i.e. test.xml:
<?xml version="1.0"?>
<svg width="352px" height="352px" viewBox="0 0 176 176"
xmlns:xlink="http://www.w3.org/1999/xlink";>
<defs>
<g id="slats">
<rect x="0" y="0" width="78" height="20" style="fill:white;"/>
<line x1="0" y1="10" x2="78" y2="10" style="stroke-width:20;stroke-linecap:butt;stroke-dasharray:2,2"/>
</g>
<g id="SwayBridge" style="stroke:black; stroke-width:1.5; stroke-linecap:round">
<rect x="0" y="0" width="45" height="20" style="fill:#ffcc33;"/>
<use xlink:href="#slats" transform="translate(45,0)"/>
<rect x="123" y="0" width="45" height="20" style="fill:#ffcc33;"/>
</g>
</defs>
<g transform="translate(4,78)">
<g id="rotate" transform="rotate(90,84,10)">
<use xlink:href="#SwayBridge"/>
</g>
</g>
</svg>


Any help would be greatly appreciated.
Thanks
Steve

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to