You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Ahmad Morad <mo...@db.informatik.uni-kassel.de> on 2002/03/04 17:21:12 UTC

JSVGComponent

Hi all,

with the following code I want to render an SVG document wich I produced
someway :
--
        private JSVGCanvas viewport;
	...
        SVGDocument svgDoc = domToSVGDom(node);
	viewport.setSVGDocument(svgDoc);
--

Then I got the following axception:

---
java.lang.ClassCastException: org.apache.batik.dom.GenericElementNS
        at org.apache.batik.dom.svg.SVGOMDocument.getRootElement(Unknown      
        Source)
        at org.apache.batik.swing.svg.JSVGComponent.setSVGDocument(Unknown    
        Source)
        at tcldbc.TclDBSVGViewer.viewTable(TclDBSVGViewer.java:244)
        ...

---

However the SVGDocument I produced is ok! and I can serialize it. Doing that
and saving it in a file. I get a correct SVG document which I can view with 
the SVGViewer or the Sample application with the batik sources. 

Has anybody an Idea about this Exception?

Thanks,
Morad.

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


Re: JSVGComponent

Posted by Ahmad Morad <mo...@db.informatik.uni-kassel.de>.

> By the way, what DOM implementation are you using? It will help to see what
> is the problem with deepCloneDocument().

Hi Stephane,
I use the SVGDOMImplementation! I think there is a problem in 
DocumentWrapper.importNode() method!!!

SVGDOMImplementation impl = (SVGDOMImplementation) 
	    SVGDOMImplementation.getDOMImplementation();
	

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


RE: JSVGComponent

Posted by Stephane Hillion <sh...@ilog.fr>.
> From: Ahmad Morad [mailto:morad@db.informatik.uni-kassel.de]
> Sent: lundi 4 mars 2002 17:21
> To: batik-dev@xml.apache.org
> Subject: JSVGComponent
>
>
> Hi all,
>
> with the following code I want to render an SVG document wich I produced
> someway :
> --
>         private JSVGCanvas viewport;
> 	...
>         SVGDocument svgDoc = domToSVGDom(node);
> 	viewport.setSVGDocument(svgDoc);
> --
>
> Then I got the following axception:
>
> ---
> java.lang.ClassCastException: org.apache.batik.dom.GenericElementNS
>         at
> org.apache.batik.dom.svg.SVGOMDocument.getRootElement(Unknown
>         Source)
>         at
> org.apache.batik.swing.svg.JSVGComponent.setSVGDocument(Unknown
>         Source)
>         at tcldbc.TclDBSVGViewer.viewTable(TclDBSVGViewer.java:244)
>         ...
>
> ---
>
> However the SVGDocument I produced is ok! and I can serialize it.
> Doing that
> and saving it in a file. I get a correct SVG document which I can
> view with
> the SVGViewer or the Sample application with the batik sources.
>
> Has anybody an Idea about this Exception?
>

Your nodes are not in the SVG namespace.
Use createElementNS() instead of createElement() in your domToSVGDom()
method to solve your problem.

By the way, what DOM implementation are you using? It will help to see what
is the problem with deepCloneDocument().
--
  Stephane.



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