xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fawzib Rojas <f_ro...@spectron-msim.com>
Subject Re: Batik problems in Cocoon 2.2
Date Thu, 21 Oct 2010 16:46:13 GMT
On 10/21/2010 7:27 AM, thomas.deweese@kodak.com wrote:
> Hi Fawzib,
> Fawzib Rojas <f_rojas@spectron-msim.com> wrote on 10/20/2010 03:37:18 PM:
> > I don't know how to do that, never worked with Batik until now. The
> > source of the cocoon-batik-block is
> > at http://www.megaupload.com/?d=NQBUKM9W
>         I took a quick look at the code here, in particular SVGBuilder.
> The code in that class looks really questionable to me.  It subclasses
> our SAXSVGDocumentFactory and tries to manipulate the base classes state.
> This is in general a bad idea and exactly the sort of hacks that tend to
> cause breakage when the baseclass code changes.
>         So the one thing I noticed that at least looks like real 
> trouble is
> in the override of startDocument the class tries to set the base classes
> 'document' member.  But it then calls the baseclasses startDocument 
> method,
> which is just going to 'null' out the document member.
>         Also the attempts to manipulate the set of namespace prefixes
> seems problematic to me.

That code was made by the cocoon guys dont blame me :)

 From looking at that code it is just used to sets (fix?) the namespace. 
I was recreating the DOM using DOMUtilities.deepCloneDocument before the 
transcode so I thought it was not needed. I removed startDocument  and 
it made no difference. Gave me the same error so I removed the 
DOMUtilities.deepCloneDocument part.

>         I took a look at SVGSerializerNG and I didn't see anything
> wrong but since the problem with the document probably occured
> before that I don't think that means much.
>         BTW I would try printing the namespace and tag name for the root
> element of the document passed to the serializer and see if that is 
> correct
> (I suspect it isn't).

Yes the problem comes before that but I have no idea where.
The document I'm using for testing is 
I checked the root element like u asked and it looks like this:

preserveAspectRatio="xMidYMid meet"

I changed startElement and added a loop to print all attributes in the 
svg element. It prints all the attributes except both xmlns 
declarations. It seems something somewhere is filtering them out. Since 
it cant find the attribute, there is no namespace. I added some code so 
that if there is no namespace it adds it. It's basically the same the 
cocoon guys did but I added it in startElement just as it creates the 
document. The new code is at http://www.megaupload.com/?d=WQNQUDQJ if 
you want to look at it.

After those changes things moved along a little bit farther down the 
line but now batik gives me a NullPointerException in 
JPEGTranscoder.writeImage, I checked the output stream and it is valid, 
so must be something else:

Caused by: java.lang.NullPointerException
at org.apache.cocoon.xml.dom.SVGBuilder.endDocument(SVGBuilder.java:127)

View raw message