> However, if the standard clone call is implemented, why add the
createCopy()
> method.  Is there a preference of one over the other?

Jim:

I was working on an application last night that I believe is an example
where .createCopy() is more useful than .clone().

Aside from making a "deep copy" of the object it is "cloning", .createCopy()
also "detaches" the object from the rest of the object tree.  I had a
situation where I wanted to remove all instances of <table> from an xhtml
document, and write them out to separate files.  .createCopy() simplifies
this process.  Without the detach(), I wouldn't be able to "add" the table
elements as the root element to a new document that I write out.

I see it as a convenience method... nice of James to include it in the API.

Rob




_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to