I am attempting to transcode the results of an XSL translation. With other systems like FOP I was able to get a ContentHandler from FOP that the XSL engine would send events to. I see that TranscoderInput takes an XMLReader in the constructor but how to make that work with a ContentHandler has me confused. Do I make my own implementation of XMLReader so Batik will call XMLReader.setContentHandler? What order would I make my calls (ie: construct TranscoderInput, Transformer.transform, PNGTranscoder.transcode)?

In an attempt to get a quick and inefficient solution I have made a temporary DOM document from the result of the XSL transformation. I get a DOMException while transcoding so I still have no solution. Here is that code:

DOMResult domOutput = ...

... Do xsl translation

        TranscoderInput input = new TranscoderInput(
                        domOutput.getNode().getOwnerDocument());

        TranscoderOutput output = new TranscoderOutput(
                        response.getOutputStream());

ImageTranscoder transcoder = new PNGTranscoder();

        try
        {
                transcoder.transcode(input, output);
        }
        catch (TranscoderException e)
        {
                throw new Error("Unexpected TranscoderException", e);
        }

This gives me the following DOMException:

Exception in thread "main" org.w3c.dom.DOMException: The current node (type: 9, name: #document) do not allow children of the given type (type: 1, name: svg:svg)
at org.apache.batik.dom.AbstractNode.createDOMException(Unknown Source)
at org.apache.batik.dom.AbstractDocument.checkChildType(Unknown Source)
at org.apache.batik.dom.AbstractParentNode.checkAndRemove(Unknown Source)
at org.apache.batik.dom.AbstractParentNode.insertBefore(Unknown Source)
at org.apache.batik.dom.util.DOMUtilities.deepCloneDocument(Unknown Source)
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 net.sf.colle.xml.BatikPlugin.finalizeResult(BatikPlugin.java:120)
at net.sf.colle.xml.Transformation.transform(Transformation.java:384)
at com.schield.market_indices.ThumbnailGenerator.generate(ThumbnailGenerato r.java:111)
at com.schield.market_indices.ThumbnailGenerator.main(ThumbnailGenerator.ja va:57)


Any help is appreciated. I will take an inefficient DOM solution for now but I would prefer a SAX solution.

Dwayne Schultz



============================

Use the right kind of glue
http://colle.sf.net


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



Reply via email to