I have experience with it: I wrote it...
What I can say is that the problem don't come from the component.
Sorry but I must repeat what I wrote in my previous email: you are creating
the elements of the DOM in the wrong namespace. Use createElementNS in you
cloning method instead of createElement and it will work.

> -----Original Message-----
> From: Ahmad Morad [mailto:[EMAIL PROTECTED]]
> Sent: mardi 5 mars 2002 11:16
> To: [EMAIL PROTECTED]
> Subject: JSVGComponent.setSVGDocument method
>
>
> Does anybody have experience with the
> JSVGComponent.setSVGDocument(SVGDocument doc) method?
>
> I used the same document one time with the setURI() method, and the other
> throw producing a dom from the file and calling setSVGDocument().
> If I serialize the dom I produced, I get the same SVG document. So I guess
> there is a little bug with the setSVGDocument() method!!
>
> --
>  /**
>      * Sets the SVG document to display.
>      */
>     public void setSVGDocument(SVGDocument doc) {
>         ...
>
>         if (eventsEnabled && svgDocument != null) {
>             // fire the unload event
>             Event evt = svgDocument.createEvent("SVGEvents");
>             evt.initEvent("SVGUnload", false, false);
>
> ((EventTarget)(svgDocument.getRootElement())).dispatchEvent(evt);
>         }
>
>         svgDocument = doc;
>
>         ...
>     }
> --
>
> I think the svgDocument must be null at the first call of
> setSVGDocument().
> This is however not the case. The line :
>
>    ((EventTarget)(svgDocument.getRootElement())).dispatchEvent(evt);
>
> will be executed at the first call and  produce an exception like:
>
> --
> java.lang.ClassCastException: org.apache.batik.dom.GenericElementNS
>         at
> org.apache.batik.dom.svg.SVGOMDocument.getRootElement(Unknown
>         Source)
>        ...
> --
>
> Thanks,
> Morad.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to