[jdom-interest] Why no containsChild() or containsAttribute()

Jason Hunter jhunter at collab.net
Mon Jan 29 09:47:46 PST 2001


Xavier Witdouck wrote:
> 
> Hi Guys,
> 
> JDOM's a great piece of work...I do have a question however.  It seems that
> the Element class' methods for getChild(String name) and getAttribute(String
> name) throw typed exceptions if that child or attribute does not exist.
> Since an attribute or child element may be marked #REQUIRED it would seem to
> me that throwing an exception in this case is not the right thing to do, as
> it is not an error condition.  It would seem more natural to return null if
> the child or attribute does not exist????

We've been returning null for, oh, about 5 months now.  Might I suggest
you upgrade your JDOM version.  :-)

-jh-



More information about the jdom-interest mailing list