[jdom-interest] Element.getText() null vs. ""

Jason Hunter jhunter at collab.net
Tue Apr 17 15:07:38 PDT 2001


D Gross wrote:
> 
> Element.getText() returns an empty String if the content is null.  The
> javadoc says this, but also says it will return null (in the @return
> doc).  I think it is more appropriate for it to return null than "",
> since "" implies the Element has content.

If you look at the latest CVS code (which everyone should PLEASE do
before you report bugs) you'll note the Javadocs are consistent that get
Text() returns "" if there's no text content.

This is appropriate because: <foo></foo> can easily be seen as having ""
as text content.

-jh-



More information about the jdom-interest mailing list