[jdom-interest] detach() [eg]

Steven D. Keens skeens at planetfred.com
Tue Apr 24 06:18:25 PDT 2001

Is there any benefit from subclassing Element
with a new RootElement class that behaves
differently on a detach()?

Just a thought and I should probably think
about more before I throw it out there but
I have to get back to my real job today,
rather than reading the JDOM interest groups :-)

>-----Original Message-----
>From: jdom-interest-admin at jdom.org
>[mailto:jdom-interest-admin at jdom.org]On Behalf Of Jason Hunter
>Sent: Tuesday, April 24, 2001 02:32
>To: Scott Means
>Cc: jdom-interest at jdom.org
>Subject: Re: [jdom-interest] detach() [eg]
>Scott Means wrote:
>> Ok, how's this for an alternative. I think that everybody agrees that
>> create a new, randomly named element is a Bad Idea. How about
>this: in the
>> root element case, go ahead and detach the element from the
>document. Then,
>> clone it and put the cloned copy back in the document. I know,
>it's kind of
>> ugly, but the document still has a root. No exceptions need be
>thrown. Your
>> original element is now free to join another tree somewhere else. As a
>> programmer, I might think it was kind of odd to still have an
>extra copy of
>> an element that I thought I had detached, but I would probably be able to
>> deal with it. At least is isn't as ugly as having
>> floating around in my document. I can just see too many cases
>> like the one where the stack-oriented application guy was going) where
>> these things will find their way into the body of the document,
>and I would
>> prefer to nip the three hour debugging session in the bud if I could.
>> Anyway, it's another option.
>Problem is, if the doc is non-trivial in size that little clone() call
>is going to be quite a resource drain.
>To control your jdom-interest membership:
r at yourhost.com

More information about the jdom-interest mailing list