java - JavaFX WebView importNode -


i use webview display svg image , i'd add svg image child of 1 of nodes of original svg (similar described here using batik: how superimpose 1 svg image onto using apache batik?). classcastexception.
here use base svg image:

final string svg = "background.svg"; final uri = paths.get(svg).toabsolutepath().touri(); webview root = new webview(); root.getengine().load(uri.tostring()); 

the svg dislays correctly.
have piece of code, executed when user press button, tries add image parent svg:

file anotherfile = new file("over.svg"); documentbuilderfactory dbfactory = documentbuilderfactory.newinstance(); documentbuilder dbuilder = dbuilder = dbfactory.newdocumentbuilder(); document doc = dbuilder.parse(anotherfile);  node e = root.getengine().getdocument().importnode(doc.getdocumentelement(), true); root.getengine().getdocument().appendchild(e); 

the following exception occurs when trying use importnode:

java.lang.classcastexception: com.sun.org.apache.xerces.internal.dom.deferredelementimpl cannot cast com.sun.webkit.dom.nodeimpl 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -