hello,

I am trying to initiate a JSVGCanvas from a String I get from a RMI remote
object

public CanvasProxy(long fps, String rmiRegistryLocation)
throwsNotBoundException, ParserConfigurationException, SAXException,
IOException {

connect(rmiRegistryLocation);

        canvas = new JSVGCanvas();

canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);

canvas.setDocument(createDoc());


...




 private Document createDoc() throws ParserConfigurationException,

RemoteException, SAXException, IOException {

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();

InputStream inStream = new ByteArrayInputStream(remoteEngine
.getSvgDocument().getBytes());

return builder.parse(inStream);

}



I get This exception

java.lang.ClassCastException: org.apache.batik.dom.GenericElement cannot be
cast to org.w3c.dom.svg.SVGSVGElement
at
org.apache.batik.dom.svg.SVGOMDocument.getRootElement(SVGOMDocument.java:233)
at
org.apache.batik.bridge.BridgeContext.getBridgeExtensions(BridgeContext.java:2049)
at
org.apache.batik.bridge.BridgeContext.registerSVGBridges(BridgeContext.java:2038)
at org.apache.batik.bridge.BridgeContext.setDocument(BridgeContext.java:442)
at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:54)
at org.apache.batik.swing.svg.GVTTreeBuilder.run(GVTTreeBuilder.java:96)


When I do this, it is all right. What's wrong?


 public CanvasProxy(long fps, String rmiRegistryLocation)
throwsNotBoundException, ParserConfigurationException, SAXException,
IOException {

connect(rmiRegistryLocation);

        canvas = new JSVGCanvas();

canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);

canvas.setURI(remoteEngine.getSvgDocumentURI().toString());
-- 
Dao Hodac

Reply via email to