[jdom-interest] getDocument() patch
Ernst de Haan
ernst at jollem.com
Mon Sep 25 08:01:42 PDT 2000
Hi Bob,
An alternative solution would be to subclass Element. Name the subclass
RootElement, and give it the mentioned field of type Document. The
isRootElement() method of the superclass Element can be implemented as
returning false, while it is overloaded in the subclass RootElement to return
true.
The advantage of my suggested approach is mailly less memory consumption. A
simple pointer (the reference to a Document) is 4 bytes (32 bits). For a large
XML tree this can make a considerable difference.
Just my 2 cts.
Ernst
bob wrote:
>
>
> http://code.werken.com/document_patch.txt
>
> Synopsis:
>
> Removed isRootElement boolean flag, and replaced with a Document document
> member. Held only by the root element. isRootElement() now tests against
> (this.document != null).
>
> Removed setIsRootElement() and added setDocument() instead.
>
> Added getDocument() which recurses to an element which isRootElement(),
> and returns it's this.document, or null, if not a part of a well-formed
> Document.
>
> Patch against the CVS tree as of 9:45pm Eastern tonight.
>
> It compiled, but I haven't really tested it.
>
> btw, diff -u now includes, by default, the ant-modified
> build scripts with EOL changes. Blaugh.
>
> -bob
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>
More information about the jdom-interest
mailing list