For those that may run into this problem in the future, possibly I can save 
them a bit of the grief I went through in figuring this out. I turns out that 
the implementation of clone() is different in AbstractElement than it is in 
DefaultElement. In DefaultElement the behaviour of both clone() and 
createCopy() are indeed a deep copy. However, in AbstractElement the 
behaviour of clone(), and therefore createCopy(), is a shalllow copy. The fix 
I employed was simply to copy the code from DefaultElement up to my base 
element class.

This behaviour is not as per the API documentation which clearly states that 
AbstractElement .createCopy() is a deep copy. Further that API does not even 
document that clone() is implemented by  AbstractElement. It would be helpful 
if either the implementation could be changed or at least clearly document 
the differences in behaviour.

Cheers,
Joel


On Monday 07 June 2004 21:23, Joel Rosi-Schwartz wrote:
> Hi,
> I have created a custom DocumentFactory implementation to support my
> applications model. All works fine except for when I try to use either
> createCopy() or clone(). Essentially I just get the original element
> returned. I guess I am missing something. What do I need to do either in my
> DocumentFactory class or my model classes to get the proper support for
> these methods.
>
> By the way thanks a lot for the great system. I have been using dom4j
> extensively for the past three years and this is first support request I
> have made. That says an awful lot the both the quality of dom4j and the
> thoughtfulness of the api.
>
>
> Cheers,
> Joel



-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
>From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to