xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathan wood <jonathanshaww...@gmail.com>
Subject Re: Batik problems in Cocoon 2.2
Date Tue, 19 Oct 2010 20:59:23 GMT
Greetings,

  This is almost certainly a namespace issue.  I'd suggest the
following 3 things:

  - Check and/or post your parse sequence using SAXSVGDocumentFactory.
(less likely if unchange during upgrades)

  - Check and/or post(if of appropriate size) your raw input document.
(less likely if unchange during upgrades)

  - Check your classpath for duplicate (xmlparsing?) jars with
differing versions.


Happy to help further if needed... more detail always useful.


On Tue, Oct 19, 2010 at 4:05 PM, Fawzib Rojas <f_rojas@spectron-msim.com> wrote:
>  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-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

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


Mime
View raw message