xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boon, David" <david_b...@xelus.com>
Subject Trancoder Exception, not an SVG Document
Date Mon, 09 Jul 2001 20:18:18 GMT
I'm trying to use the Transcoding api to convert an org.w3c.dom.Document
object to a JPEG image.  I'm using the sample code for the transcoder that
comes with batik.  

The Document object that I'm trying to transcode is the result of an XSL
transformation.  This document transforms when I use the rasterizer from the
command line.  When I try to transcode this document using the transcoder
api I get:
"org.apache.batik.transcoder.TranscoderException: The specified XML document
fragment is not an SVG document".  the method that looks to be throwing this
exception is transcode(TranscoderInput, TranscoderOuput)...

Here is the code that I'm using to perform the transformation:
            TransformerFactory tfactory = TransformerFactory.newInstance();
            File f = new File("d:/dev/svg/d3/d3.xsl");
            Transformer transformer = tfactory.newTransformer( new
            OutputStream out = resp.getOutputStream();
            DOMResult result = new DOMResult();
StreamSource("file:///d:/dev/svg/d3/grid.xml"), result);
            Document resultNode = (Document)result.getNode();
            printDom( System.out, resultNode );
            transcode( resultNode);

Here is the code that I'm using to turn the dom into a jpeg:
        JPEGTranscoder t = new JPEGTranscoder();
        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8));
        TranscoderInput input = new TranscoderInput(doc);
        OutputStream ostream = new FileOutputStream("out.jpg");
        TranscoderOutput output = new TranscoderOutput(ostream);
        t.transcode(input, output);

Environment information:
Windows NT
java version "1.3.1-rc1"
Xerces 1.2.3
Xalan 2.0

David Boon
Xelus, Inc.
Phone: (716)419-3344

View raw message