You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Colin Hall <ch...@thelevel.com> on 2002/02/09 03:00:40 UTC

SVG to JPEG

Hi all,
I am trying to generate a JPEG image from SVG.  I can get this to work if I
generate the source SVG, save it to disk and then put the source file
through the svgtojpeg serializer.  In other words, it appears that the
svgtojpeg serialzer will work in this instance.

The problem is that in real life, the source for the SVG is being
dynamically generated, so reading the source from disk can't happen.  The
pipeline I use to do this looks something like this:
...
<map:pipeline>
 <map:match pattern="test/jpeg/*.svg">
  <map:act type="graphing">
     <map:parameter name="descriptor"

value="@deploy-path@/gfa/logic/descriptors/graphing_config.xml"/>
       <map:generate type="serverpages"
                     src="@deploy-path@/gfa/logic/xsp/graph3a.xsp"/>
        <map:transform
src="@deploy-path@/gfa/stylesheets/com.thelevel.graph.xsl"/>
     <map:serialize type="svg2jpeg"/>
   </map:act>
  </map:match>
 </map:pipeline>
...

In the above scenario, the graphing action gets the data from the database
and puts it into an object.  The information in that object is then
translated into XML by an xsp.  That XML is then converted into SVG by an
XSL sheet which is fed through the svgtojpeg serializer.

The error seems to occur during the streaming from generator to transformer
to serializer.
The snippet below is the result of my debugging to System.out from the XSP
page and the Exception's output.

<openGraphSet1>
</openGraphSet1>
<openGraphSet2> org.w3c.dom.DOMException: The current node (type: 9, name:
#document) do not allow children of the given type (type: 3, name: #text)
        at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3174)
        at java.lang.Thread.run(Thread.java:484)
</openGraphSet2>
<openGraphSet3>
</openGraphSet3>

The interesting thing is that the Exception is nested in my debugging code.
It seems like something is expecting a complete event stream and gagging as
a result of not getting it...which would explain why the static SVG source
works but not the dynamic.

Any suggestions?

Thanks in advance.

-----------------------
Colin Hall
The Level
www.thelevel.com
-----------------------



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>