Hello, I'm trying to get Batik 1.7 running in Cocoon 2.2. I think I should start from the beginning.

I'm moving from Cocoon 2.1 to 2.2 (2.2 uses maven for everything), I created the webapp and tried to use the fop-block in cocoon but the fop version it wants to use is 0.20.5 and batik-1.6. The problem is that with that combination embedded SVGs wont work in fop. I downloaded the fop-ng-block and now have a working cocoon 2.2 with fop-1.0 and batik-1.7.

My problem is that now the SVGSerializer (converts SVG to jpeg) part of cocoon does not work. It gives me the following error:

java.lang.NullPointerException
at org.apache.batik.dom.util.SAXDocumentFactory.startElement(SAXDocumentFactory.java:563)
.....

The problem is in this part of startElement() for some reason, parser is null:

        if (inProlog) {
            inProlog = false;
            try {
isStandalone = parser.getFeature("http://xml.org/sax/features/is-standalone";);
            } catch (SAXNotRecognizedException ex) {
            }
            try {
xmlVersion = (String) parser.getProperty("http://xml.org/sax/properties/document-xml-version";);
            } catch (SAXNotRecognizedException ex) {
            }
        }

I moved both trys to the createDocument(InputSource is) since it just saves those 2 values (why are those trys in startElement and not createDocument?). After moving both trys thingts moved along and it crashes on the transcoding part. The error I get is:

java.lang.ClassCastException: org.apache.batik.dom.GenericElement cannot be cast to org.w3c.dom.svg.SVGSVGElement

the code for transcode is:

    public void notify(Document doc) throws SAXException {
        try {
            TranscoderInput transInput = new TranscoderInput(doc);
// Buffering is done by the pipeline (See shouldSetContentLength) TranscoderOutput transOutput = new TranscoderOutput(this.output);
            transcoder.transcode(transInput, transOutput);
        } catch (TranscoderException ex) {
          ...
        } catch (Exception ex) {
          ...
        }
    }

after reading through a lot of posts I found one saying DOMUtilities.deepCloneDocument would convert dom to Batik's own DOM and do the transcode. I changed the TransocderInput constructor to this:

TranscoderInput transInput = new TranscoderInput(DOMUtilities.deepCloneDocument(doc,SVGDOMImplementation.getDOMImplementation()));

but it still gives me the same error, so I'm officially stuck. I hope someone here can help me, asked at the cocoon list 3 times and got no response.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org

Reply via email to