ninitha | 1 Sep 08:30 2009
Picon

RE: Removing DOCTYPE in the SVG XML


Thanks Michael Bishop...

I tried Transcoder as follows and am getting exception as 
element
[Ljava.lang.StackTraceElement; <at> 1de256f

The code I tried with is as follows(my svg should be saved as a file):

DOMImplementation dom = SVGDOMImplementation.getDOMImplementation(); 
		SVGDocument document =
(SVGDocument)dom.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI,
"svg", null); 				SVGGeneratorContext ctx =
SVGGeneratorContext.createDefault(document); 
		ctx.setEmbeddedFontsOn(false); 
		boolean textAsShapes = false; 
		SVGGraphics2D g2 = new SVGGraphics2D(ctx, textAsShapes); 
		g2.setSVGCanvasSize(new java.awt.Dimension(height,width)); 
		// tell JFreeChart to draw itself into the SVG
		chart.draw(g2, new Rectangle(0, 0, height,width), null); 
		 // Write svg file		
		OutputStream outputStream = new FileOutputStream(svgFileName);
		Writer out = new OutputStreamWriter(outputStream);		
		final TranscoderInput input = new TranscoderInput(document);
		final TranscoderOutput output = new TranscoderOutput(out);
		final Transcoder transcoder = new SVGTranscoder();
		 
		transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCTYPE,
SVGTranscoder.VALUE_DOCTYPE_REMOVE);
		transcoder.transcode(input, output);			
(Continue reading)

vyang | 2 Sep 16:01 2009

Re: Update Manager Failing


I think I've found the problem.  With slower computer canvas double buffering
might be too slow which cause an interruption in the update manager.  

Now with my code below, I'm just wondering if its a good idea/good coding to
put updatemanager runnables inside a swing worker.  The swingworker is used
to display an progress bar only (I believe).  I've read somewhere that the
progress bar should be run under swingutilities runnable.

vyang

vyang wrote:
> 
> Hello,
> 
> I'm having a bit of a problem with update manager failing.  On a faster
> computer there seems to be no problem but on a slower computer update
> manager seems to fail.  It seems like there is an interruption to update
> manager so it fails thus not updating my canvas.  I always thought that
> update managers runnables are put into a queue and gets called when one is
> finished.  
> 
> my code is as follows:
> 
> Vector finalDrawingLayers = drawingLayers;
> Vector finalLayerSetLayers = layerSetLayers;
> 
> SwingWorker worker = new SwingWorker(){
>                 public Object construct() {
>                     try {
(Continue reading)

HODAC, Olivier | 2 Sep 16:04 2009

transform attribute marshaller

Hello,

I am totally newby with batik and I am wondering if I am thinking right.

I have seen that there is some parsers that are used with handlers. Butr here is my requirement:

I want to change dynamically in java the position and some attributes of my initial svg file. I am focussing for the moment on the transform attribute (to move and rescale my object) and the fill attr ( to change the color)

I am doing the following. You can see that I have to create the whole transform value string each time (I could have used the format method, by the way) by hand

Is there a way to do that with some ready to use classes (ex: TransformableElement.setTransform(X_POS, value)) ?

        protected void setSize(double d) {

                getElt().setAttributeNS(null, "transform", "matrix("+d+" 0 0 "+d+" 243.3438 143.687)");

        }

        getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable() {

                        public void run() {

                setSize(theNewSize));

                        }

                });

        }

Olivier Dao Ho Dac

Flight Test Software Architect

Airbus France - EVIDA

Phone : + 33 (0)5 67 19 81 34

Fax : +33(0)5 61 93 80 02

Mailto:olivier.hodac <at> airbus.com

The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, please notify Airbus immediately and delete this e-mail. Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately. All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free.

RE: transform attribute marshaller

Hello,

I use Batik's AWTTransformProducer to go from a "transform" attribute to
an AffineTransform.  I manipulate the AffineTransform however I need to,
then use the MessageFormat class to write out the "transform" attribute
with the 6 values of the matrix.  I haven't found a better way to
produce the "transform" attribute, but I find manipulating an
AffineTransform to be easier to work with.

I don't know how familiar you are with transforms, but you might want to
search this list for "AffineTransformUtil" if transform operations don't
work the way you "expect" them to with cumulative updates.

Michael Bishop

-----Original Message-----
From: HODAC, Olivier [mailto:OLIVIER.HODAC <at> airbus.com] 
Sent: Wednesday, September 02, 2009 10:04 AM
To: batik-users <at> xmlgraphics.apache.org
Subject: transform attribute marshaller

Hello,

I am totally newby with batik and I am wondering if I am thinking right.

I have seen that there is some parsers that are used with handlers. Butr
here is my requirement:

I want to change dynamically in java the position and some attributes of
my initial svg file. I am focussing for the moment on the transform
attribute (to move and rescale my object) and the fill attr ( to change
the color)

I am doing the following. You can see that I have to create the whole
transform value string each time (I could have used the format method,
by the way) by hand

Is there a way to do that with some ready to use classes (ex:
TransformableElement.setTransform(X_POS, value)) ?

        protected void setSize(double d) {

                getElt().setAttributeNS(null, "transform", "matrix("+d+"
0 0 "+d+" 243.3438 143.687)");

        }

 
getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(n
ew Runnable() {

                        public void run() {

                setSize(theNewSize));

                        }

                });

        }

Olivier Dao Ho Dac

Flight Test Software Architect

Airbus France - EVIDA

Phone : + 33 (0)5 67 19 81 34

Fax : +33(0)5 61 93 80 02

Mailto:olivier.hodac <at> airbus.com

The information in this e-mail is confidential. The contents may not be
disclosed or used by anyone other than the addressee. Access to this
e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately
and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness
of this e-mail as it has been sent over public networks. If you have any
concerns over the content of this message or its Accuracy or Integrity,
please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated
virus scanning software but you should take whatever measures you deem
to be appropriate to ensure that this message and any attachments are
virus free.
HODAC, Olivier | 2 Sep 16:56 2009

RE: transform attribute marshaller

Thanks michael

If I understand well, I create a new affineTransform from the attribute transform string using the static method
AffineTransform  at = AWTTransformProducer.createAffineTransform(String s)

Then, I use the setters from the AffineTransform to set the rotation value, etc...

Finally, I use the standart java MessageFormat stuff to marshall it? You mean that I explicitely write:

MessageFormat.format("matrix(%f %f %f %f %f %f)", at.getScaleX() , etc...)?

-----Message d'origine-----
De : Bishop, Michael W. CTR USJFCOM JFL [mailto:michael.bishop.ctr <at> jfcom.mil] 
Envoyé : mercredi 2 septembre 2009 16:35
À : batik-users <at> xmlgraphics.apache.org
Objet : RE: transform attribute marshaller

Hello,

I use Batik's AWTTransformProducer to go from a "transform" attribute to
an AffineTransform.  I manipulate the AffineTransform however I need to,
then use the MessageFormat class to write out the "transform" attribute
with the 6 values of the matrix.  I haven't found a better way to
produce the "transform" attribute, but I find manipulating an
AffineTransform to be easier to work with.

I don't know how familiar you are with transforms, but you might want to
search this list for "AffineTransformUtil" if transform operations don't
work the way you "expect" them to with cumulative updates.

Michael Bishop

-----Original Message-----
From: HODAC, Olivier [mailto:OLIVIER.HODAC <at> airbus.com] 
Sent: Wednesday, September 02, 2009 10:04 AM
To: batik-users <at> xmlgraphics.apache.org
Subject: transform attribute marshaller

Hello,

I am totally newby with batik and I am wondering if I am thinking right.

I have seen that there is some parsers that are used with handlers. Butr
here is my requirement:

I want to change dynamically in java the position and some attributes of
my initial svg file. I am focussing for the moment on the transform
attribute (to move and rescale my object) and the fill attr ( to change
the color)

I am doing the following. You can see that I have to create the whole
transform value string each time (I could have used the format method,
by the way) by hand

Is there a way to do that with some ready to use classes (ex:
TransformableElement.setTransform(X_POS, value)) ?

        protected void setSize(double d) {

                getElt().setAttributeNS(null, "transform", "matrix("+d+"
0 0 "+d+" 243.3438 143.687)");

        }

 
getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(n
ew Runnable() {

                        public void run() {

                setSize(theNewSize));

                        }

                });

        }

Olivier Dao Ho Dac

Flight Test Software Architect

Airbus France - EVIDA

Phone : + 33 (0)5 67 19 81 34

Fax : +33(0)5 61 93 80 02

Mailto:olivier.hodac <at> airbus.com

The information in this e-mail is confidential. The contents may not be
disclosed or used by anyone other than the addressee. Access to this
e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately
and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness
of this e-mail as it has been sent over public networks. If you have any
concerns over the content of this message or its Accuracy or Integrity,
please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated
virus scanning software but you should take whatever measures you deem
to be appropriate to ensure that this message and any attachments are
virus free.

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

This mail has originated outside your organization, either from an external partner or the Global Internet.
Keep this in mind if you answer this message.

The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other
than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent
over public networks. If you have any concerns over the content of this message or its Accuracy or
Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you
should take whatever measures you deem to be appropriate to ensure that this message and any attachments
are virus free.

RE: transform attribute marshaller

Yes, except for at.getScaleX(), I do:

double[] matrixValues = new double[6];
matrix.getMatrix(matrixValues);

Then I use matrixValues[0 - 5] to populate the "matrix" part of the "transform" attribute.

Although, reading the Javadoc, I guess it doesn't matter.  You could use:

getScaleX(), getShearY(), getShearX(), getScaleY(), getTranslateX(), and getTranslateY() in that
order to get the same values.

Either way, it's a little tedious, but it works.

Michael

-----Original Message-----
From: HODAC, Olivier [mailto:OLIVIER.HODAC <at> airbus.com] 
Sent: Wednesday, September 02, 2009 10:56 AM
To: batik-users <at> xmlgraphics.apache.org
Subject: RE: transform attribute marshaller

Thanks michael

If I understand well, I create a new affineTransform from the attribute transform string using the static
method AffineTransform  at = AWTTransformProducer.createAffineTransform(String s)

Then, I use the setters from the AffineTransform to set the rotation value, etc...

Finally, I use the standart java MessageFormat stuff to marshall it? You mean that I explicitely write:

MessageFormat.format("matrix(%f %f %f %f %f %f)", at.getScaleX() , etc...)?

-----Message d'origine-----
De : Bishop, Michael W. CTR USJFCOM JFL [mailto:michael.bishop.ctr <at> jfcom.mil]
Envoyé : mercredi 2 septembre 2009 16:35 À : batik-users <at> xmlgraphics.apache.org
Objet : RE: transform attribute marshaller

Hello,

I use Batik's AWTTransformProducer to go from a "transform" attribute to an AffineTransform.  I
manipulate the AffineTransform however I need to, then use the MessageFormat class to write out the
"transform" attribute with the 6 values of the matrix.  I haven't found a better way to produce the
"transform" attribute, but I find manipulating an AffineTransform to be easier to work with.

I don't know how familiar you are with transforms, but you might want to search this list for
"AffineTransformUtil" if transform operations don't work the way you "expect" them to with cumulative updates.

Michael Bishop

-----Original Message-----
From: HODAC, Olivier [mailto:OLIVIER.HODAC <at> airbus.com]
Sent: Wednesday, September 02, 2009 10:04 AM
To: batik-users <at> xmlgraphics.apache.org
Subject: transform attribute marshaller

Hello,

I am totally newby with batik and I am wondering if I am thinking right.

I have seen that there is some parsers that are used with handlers. Butr here is my requirement:

I want to change dynamically in java the position and some attributes of my initial svg file. I am focussing
for the moment on the transform attribute (to move and rescale my object) and the fill attr ( to change the color)

I am doing the following. You can see that I have to create the whole transform value string each time (I could
have used the format method, by the way) by hand

Is there a way to do that with some ready to use classes (ex:
TransformableElement.setTransform(X_POS, value)) ?

        protected void setSize(double d) {

                getElt().setAttributeNS(null, "transform", "matrix("+d+"
0 0 "+d+" 243.3438 143.687)");

        }

 
getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(n
ew Runnable() {

                        public void run() {

                setSize(theNewSize));

                        }

                });

        }

Olivier Dao Ho Dac

Flight Test Software Architect

Airbus France - EVIDA

Phone : + 33 (0)5 67 19 81 34

Fax : +33(0)5 61 93 80 02

Mailto:olivier.hodac <at> airbus.com

The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other
than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent
over public networks. If you have any concerns over the content of this message or its Accuracy or
Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you
should take whatever measures you deem to be appropriate to ensure that this message and any attachments
are virus free.

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

This mail has originated outside your organization, either from an external partner or the Global Internet.
Keep this in mind if you answer this message.

The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other
than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent
over public networks. If you have any concerns over the content of this message or its Accuracy or
Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you
should take whatever measures you deem to be appropriate to ensure that this message and any attachments
are virus free.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe <at> xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help <at> xmlgraphics.apache.org
HODAC, Olivier | 2 Sep 17:12 2009

RE: transform attribute marshaller

OK, thank's (so fast!!!)

-----Message d'origine-----
De : Bishop, Michael W. CTR USJFCOM JFL [mailto:michael.bishop.ctr <at> jfcom.mil] 
Envoyé : mercredi 2 septembre 2009 17:11
À : batik-users <at> xmlgraphics.apache.org
Objet : RE: transform attribute marshaller

Yes, except for at.getScaleX(), I do:

double[] matrixValues = new double[6];
matrix.getMatrix(matrixValues);

Then I use matrixValues[0 - 5] to populate the "matrix" part of the "transform" attribute.

Although, reading the Javadoc, I guess it doesn't matter.  You could use:

getScaleX(), getShearY(), getShearX(), getScaleY(), getTranslateX(), and getTranslateY() in that
order to get the same values.

Either way, it's a little tedious, but it works.

Michael

-----Original Message-----
From: HODAC, Olivier [mailto:OLIVIER.HODAC <at> airbus.com] 
Sent: Wednesday, September 02, 2009 10:56 AM
To: batik-users <at> xmlgraphics.apache.org
Subject: RE: transform attribute marshaller

Thanks michael

If I understand well, I create a new affineTransform from the attribute transform string using the static
method AffineTransform  at = AWTTransformProducer.createAffineTransform(String s)

Then, I use the setters from the AffineTransform to set the rotation value, etc...

Finally, I use the standart java MessageFormat stuff to marshall it? You mean that I explicitely write:

MessageFormat.format("matrix(%f %f %f %f %f %f)", at.getScaleX() , etc...)?

-----Message d'origine-----
De : Bishop, Michael W. CTR USJFCOM JFL [mailto:michael.bishop.ctr <at> jfcom.mil]
Envoyé : mercredi 2 septembre 2009 16:35 À : batik-users <at> xmlgraphics.apache.org
Objet : RE: transform attribute marshaller

Hello,

I use Batik's AWTTransformProducer to go from a "transform" attribute to an AffineTransform.  I
manipulate the AffineTransform however I need to, then use the MessageFormat class to write out the
"transform" attribute with the 6 values of the matrix.  I haven't found a better way to produce the
"transform" attribute, but I find manipulating an AffineTransform to be easier to work with.

I don't know how familiar you are with transforms, but you might want to search this list for
"AffineTransformUtil" if transform operations don't work the way you "expect" them to with cumulative updates.

Michael Bishop

-----Original Message-----
From: HODAC, Olivier [mailto:OLIVIER.HODAC <at> airbus.com]
Sent: Wednesday, September 02, 2009 10:04 AM
To: batik-users <at> xmlgraphics.apache.org
Subject: transform attribute marshaller

Hello,

I am totally newby with batik and I am wondering if I am thinking right.

I have seen that there is some parsers that are used with handlers. Butr here is my requirement:

I want to change dynamically in java the position and some attributes of my initial svg file. I am focussing
for the moment on the transform attribute (to move and rescale my object) and the fill attr ( to change the color)

I am doing the following. You can see that I have to create the whole transform value string each time (I could
have used the format method, by the way) by hand

Is there a way to do that with some ready to use classes (ex:
TransformableElement.setTransform(X_POS, value)) ?

        protected void setSize(double d) {

                getElt().setAttributeNS(null, "transform", "matrix("+d+"
0 0 "+d+" 243.3438 143.687)");

        }

 
getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(n
ew Runnable() {

                        public void run() {

                setSize(theNewSize));

                        }

                });

        }

Olivier Dao Ho Dac

Flight Test Software Architect

Airbus France - EVIDA

Phone : + 33 (0)5 67 19 81 34

Fax : +33(0)5 61 93 80 02

Mailto:olivier.hodac <at> airbus.com

The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other
than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent
over public networks. If you have any concerns over the content of this message or its Accuracy or
Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you
should take whatever measures you deem to be appropriate to ensure that this message and any attachments
are virus free.

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

This mail has originated outside your organization, either from an external partner or the Global Internet.
Keep this in mind if you answer this message.

The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other
than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent
over public networks. If you have any concerns over the content of this message or its Accuracy or
Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you
should take whatever measures you deem to be appropriate to ensure that this message and any attachments
are virus free.

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

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

This mail has originated outside your organization, either from an external partner or the Global Internet.
Keep this in mind if you answer this message.

The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other
than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent
over public networks. If you have any concerns over the content of this message or its Accuracy or
Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you
should take whatever measures you deem to be appropriate to ensure that this message and any attachments
are virus free.
Mathieu Pedrero | 2 Sep 20:44 2009
Picon

Re: Unknown language: text/ecmascript [Precisions inside: problem with DOMUtilities]

Hi Everybody!

I didn't forget my problem, but i was away from any kind of web connection for a long time!
 
> java.lang.NullPointerException
>     at
> org.apache.batik.bridge.BridgeContext.getInterpreter(BridgeContext.java:566)
[...]
> And it's when i try to display the previewDocument into any JSVGCanvas that
> I get my Exception. The exception is thrown even if I skip the
> serialization/deserialization step.

This still suggests missing jar files. Note that not only "js.jar" is
required but also the ones that this one depends upon. Please double
check your environment (classpath/includes) comparing with the
dependency graph [1].


I double-checked my classpath, and every one (i say everyone; the white ones, the light blue ones, and the dark ones) of the different libraries of the dependency graph are present in my class path.
 

> I apologize for aving writen earlier that the documents were the sames in
> the two case: I thought it realy was the case, because it was working good
> with documents without JavaScript.

That's why you should avoid replacing a clear, detailed explanation
with (one or more) assumptions [2]. Of course a guess usually won't
hurt (when the rest is provided). :-)



I'll try to write you a little script in order to show precisely the problem (whithout any assuptions). But, waiting for it, can you help me, please, whith the DOMUtilities.parseXML method? I'm not very comfortable using this method (and the correct parameters to feed it), and the Batik Javadoc doesn't help me very much.
 
Thanks a lot!

Helder Magalhães | 3 Sep 10:56 2009
Picon

Re: Unknown language: text/ecmascript [Precisions inside: problem with DOMUtilities]

Hi Mathieu,

> I'll try to write you a little script in order to show precisely the problem
> (whithout any assuptions).

Great. Being able to easily reproduce always helps a lot.

> But, waiting for it, can you help me, please,
> whith the DOMUtilities.parseXML method? I'm not very comfortable using this
> method (and the correct parameters to feed it), and the Batik Javadoc
> doesn't help me very much.

Maybe the ECMAScript version documentation [1] will help...?

Have you tried crawling through the Batik source code [2] and/or Web
for sample usages of the method? ;-)

> Thanks a lot!

Hope this helps,
 Helder

[1] http://xmlgraphics.apache.org/batik/status.html#ecmascript
[2] http://xmlgraphics.apache.org/batik/download.cgi#Subversion+repository
Mathieu Pedrero | 3 Sep 11:06 2009
Picon

Re: Unknown language: text/ecmascript [Precisions inside: problem with DOMUtilities]

Hi Everybody!

I created a new project on my IDE, only to make some test about this problem, and i think I was right when I tought the DOMUtilities to be at the roots of my problem.

To begin with, I guarante you that all the jar's of the dependency graph of batik are included to the classpath of my new project:

#############################################
Begining of the code:
Here is the Constructor of a class (extending JFrame), called by the main method in the Main class of my project. Nothig else is done
#############################################

    public Molasson() {
// This method (created by my IDE) creates and adds jpanel1 and jPanel2 to the JFrame.
// I dont reprt it's source code, it's not important
        initComponents();
       
        this.setVisible(true);
       
        JFileChooser jfc = new JFileChooser();
        jfc.showOpenDialog(this);

//I create my two  test canvas
       
        JSVGCanvas canvas = new JSVGCanvas(), canvas2 = new JSVGCanvas();

//I set them dynamic
       
        canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
        canvas2.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
       
// I create the document I had to the first canvas

        Document document=null;
       
        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
       
        try {
            document = f.createDocument(jfc.getSelectedFile().toURI().toString());
        } catch (IOException ex) {
            ex.printStackTrace();
        }
       
// I add this document to the canvas, and the canvas to the panel.
        canvas.setDocument(document);
       
        jPanel1.add(canvas);
       
        JOptionPane jop = new JOptionPane();
       
// This confirm dialog show itself, and no exception is thrown by my canvas!

        int n = jop.showConfirmDialog(this,"Premier affichage","Stop premier affichage",jop.INFORMATION_MESSAGE);
       
// I try to "serialize" an "deserialize" my document (the same) with the help of the DOMUtilities methods

        String documentString = DOMUtilities.getXML(document.getDocumentElement());
       
        Document document2 = (Document) DOMUtilities.parseXML(documentString,null,null,null,null,f);

//I set the new document to my canvas, and this canvas to the panel!
       
        canvas2.setDocument(document2);
       
        jPanel2.add(canvas2);
       
// The exception (I presented you in my precedent messages) is thrown :(

       
    }

########################################################"
End of my code
########################################################

When I try to make my document react, on the first canvas, the javascript is executed. On the second canvas, the following exception is thrown:

########################################################
Exception stack trace
########################################################

java.lang.NullPointerException
    at org.apache.batik.bridge.BridgeContext.getInterpreter(BridgeContext.java:566)
    at org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(BaseScriptingEnvironment.java:320)
    at org.apache.batik.bridge.ScriptingEnvironment.runEventHandler(ScriptingEnvironment.java:391)
    at org.apache.batik.bridge.ScriptingEnvironment$ScriptingEventListener.handleEvent(ScriptingEnvironment.java:1440)
    at org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:324)
    at org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:366)
    at org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:266)
    at org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:1014)
    at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(BridgeEventSupport.java:403)
    at org.apache.batik.bridge.BridgeEventSupport$Listener.mouseExited(BridgeEventSupport.java:279)
    at org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDispatcher.java:628)
    at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDispatcher.java:518)
    at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatcher.java:399)
    at org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.java:211)
    at org.apache.batik.swing.svg.JSVGComponent$SVGListener$1MouseMovedRunnable.run(JSVGComponent.java:2261)
    at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:240)
    at java.lang.Thread.run(Thread.java:636)

###########################################################
End of the stack trace
###########################################################

Waiting for your advice, i'll continue tosearch bout this problem on my side!

thanks a lot!

--
Mathieu Pedrero


Gmane