Hi,

I would like to replace a specific node in a rendered svg with a node from another 
(physical) document. This is the code peformed in the updatemanager thread. The 'doc' 
is the SVGDocument of the rendered canvas. The svgFragment is the node of another svg 
file, I want to use to replace the old one with.

DocumentFragment df = doc.createDocumentFragment();
Element fragment = svgFragment.getFragment();
df.appendChild(fragment);

Node fragmentOK = doc.importNode(df, false);
Element el = doc.getElementById("replace");
el.getParentNode().replaceChild(fragmentOK, el);

I get the following error:
org.w3c.dom.DOMException: The given node (type: 11, name: #document-fragment) was not 
created by the current document.
        at org.apache.batik.dom.AbstractNode.createDOMException(AbstractNode.java:404)
        at 
org.apache.batik.dom.AbstractParentNode.checkAndRemove(AbstractParentNode.java:465)
        at 
org.apache.batik.dom.AbstractParentNode.appendChild(AbstractParentNode.java:228)
        at 
com.saudiaramco.mapboard.presentation.commands.PreferenceCommand$Updater.run(PreferenceCommand.java:55)
        at org.apache.batik.util.RunnableQueue.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:534)





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

Reply via email to