[jdom-interest] getText() returns null or ""

Louis Calisi louisc at bu.edu
Tue Oct 3 10:45:37 PDT 2000


    getText() for me in the element class returns the element's name and not the
contents. Same problem with getAtrribute(name). I do not get a null string. I have
this happen when using both beta4 and beta5.

    To answer your question I would rather see return an expty string otherwise we
would alway's have to check for a null reference which could be tedious.

Louis


Brett McLaughlin wrote:

> Folks-
>
> What's the deal with getText() returning null when it has no value?
> That's what the docs say, and I guess that one just slipped by me (I've
> been really busy lately ;-) ). In any case, that doesn't seem right -
> wouldn't it be better to return ""? Is there any functional difference
> between "" and null? It seems that returning null could cause
> NullPointerExceptions, while "" always insures you can compare Strings.
>
> Thoughts? I'd like to suggest changing to returning the empty String
> when there's no value.
>
> Thanks,
> Brett
> --
> Brett McLaughlin, Enhydra Strategist
> Lutris Technologies, Inc.
> 1200 Pacific Avenue, Suite 300
> Santa Cruz, CA 95060 USA
> http://www.lutris.com
> http://www.enhydra.org
> _______________________________________________
> 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