[jdom-interest] NoSuch*Exceptions in JDOM

Dave Hurrell dave at greatchiro.com
Fri Jun 23 22:29:56 PDT 2000


I suggest a new method following the java.util.Properties pattern
meets the underlying need and solves your problem. Namely:

  public Element getChild(String aString, Object defaultValue)

It does not throw a NoSuchElementException and can return
a null, "" or 0 as appropriate. -GreatOne--

Simon Rade wrote:

> Hi!
>
> Element's methods getAttribute() and getChild() now throws
> NoSuchElementException and NoSuchAttributeException.
> Do you think this is better than returning null in such cases?
> Since it often happens that you don't know whether child or attribute
> exists and it is very awkward to handle those Exceptions.
>
> Bye,
> Simon
> _______________________________________________
> 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