[jdom-interest] Element.getDocument() ?

Joerg joerg at freiheit.com
Fri Sep 1 03:31:34 PDT 2000


Ah, now I got the point. Jason already proposed there to replace isRootElement by
parentDocument, to set this only for the root Element and take it therefore as a flag
to mark the root Element. This was a little bit too fast for me.

I did not read it carefully enough :-) and I understood at this point to take
(parentElement == null) as an indicator for the root Element (maybe Brett had the
same misunderstanding).

Joerg


Trebor A. Rude wrote:

> 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/
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



--
<?xml version="1.0" standalone="no" encoding="ISO-8859-1"?>
<businesscard>
  <bookmarks>
    <bookmark> http://www.google.com </bookmark>
    <bookmark> http://www.gnu.org </bookmark>
    <bookmark> http://java.apache.org </bookmark>
    <bookmark> http://www.w3.org </bookmark>
    <bookmark> http://www-db.stanford.edu/lore </bookmark>
  </bookmarks>
  <sender>
    <firstname> Jörg </firstname>
    <name> Kirchhof </name>
    <title> Dipl.-Ing. </title>
    <email> joerg at freiheit.com </email>
    <phone> +49-40-890584-14 </phone>
  </sender>
  <company>
    <name> freiheit.com Technologieberatung GmbH </name>
    <address> Theodorstraße 42-90 </address>
    <zip> 22761 </zip>
    <city> Hamburg </city>
    <country> Germany </country>
    <phone> +49-40-890584-0 </phone>
    <fax> +49-40-890584-20 </fax>
    <www> http://www.freiheit.com </www>
  </company>
</businesscard>





More information about the jdom-interest mailing list