xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TAUVEL Jeremie <jtau...@actemium.com>
Subject How to use adoptNode()
Date Thu, 05 Jul 2012 15:25:42 GMT

I would like to use org.apache.batik.dom.AbstractDocument::adoptNode() instead of importNode()
to reduce cpu time and memory.
It works but in my program I dynamically update attributes in the DOM like color of stroke,
rectangle... and if I use adoptNode() it doesn't work (with importNode() it is OK).
I have seen in the source that in adoptNode1() : attr.ownerElement is set to null to be conform
with the Document Object Model (DOM) Level 3 Core Specification.

But in org.apache.batik.dom.AbstractAttr, my elements cannot be updated because it depends
of ownerElement :
if(ownerElement != null) {
ownerElement.fireDOMAttrModifiedEvent(nodeName, this, s, val, MutationEvent.MODIFICATION);

So my questions are : is it possible to use adoptNode() in my case ?
Or maybe I miss something to have ownerElement initilized with the good Element after the
adoptNode() ?

Thank you for your help.


View raw message