[jdom-interest] Element.getDocument() ?
Trebor A. Rude
trebor at bwn.net
Thu Aug 31 16:39:24 PDT 2000
On Thu, 31 Aug 2000, you wrote:
>Jason Hunter wrote:
>> bob wrote:
>> > Probably just recursively getParent() until isRootElement(),
>> > and hold a reference to the Document there. Maybe.
>>
>> Sounds about right. You could save space and some logic work by
>> getting rid of the isRootElement boolean and just handling a
>> parentDocument Element reference. For example, you implement
>> isRootElement() as:
>>
>> return (parentDocument != null);
>
>Actually, this doesn't work, as any Element created like so:
>
>Element nonRoot = new Element("foo");
>
>would think it is the root element.
>
>-Brett
Why would it think it's the root? If the Element is created that way its
parent document should be set to null (what else could it be set to?), so
!= null would return false.
--
Trebor A. Rude
trebor at bwn.net
Registered Linux User #89308
http://counter.li.org/
More information about the jdom-interest
mailing list