[jdom-interest] getText() and getAttributeValue()

Alex Rosen arosen at silverstream.com
Thu Feb 14 10:29:37 PST 2002

> And that's essentially what getAttributeValue() is doing now -- it's
> creating a null flag to report an error.

Why do you assume that the attribute not being present is an error? It may
be perfectly valid.

According to the XML spec, there is no difference between
<element></element> and <element/>, but there is a difference between
<element att=""/> and <element/>. That's why JDOM must distinguish between
these two values in getAttributeValue().

> I daresay that any method of and kind should only return null if that
> represents a legitimate working state of the system the method's class is
> encapsulating -- never to represent an error, and never when
> String is the return type.

There can be situations where both an empty string and an absent string are
both legitimate states, so neither one is an error.


More information about the jdom-interest mailing list