[jdom-interest] NoSuch*Exceptions in JDOM

Patrick Dowler Patrick.Dowler at nrc.ca
Mon Jul 10 10:05:14 PDT 2000

On Sun, 09 Jul 2000, Ken Klose wrote:
> I hope its not an intrusion for a JDOM newbie to pipe up in what seems like
> a conversation between JDOM authors, but I must agree with Jason.  I'm
> generally one to take the "ivory tower" approach of refraining from
> exceptions but if the DTD sames that <A> must contain <B> and <B> must
> contain <C> than having a <B> Element that doesn't contain <C> IS
> exceptional.  As I developer I should be able to expect the document to be
> well-formed and be forced by the compiler (through the exception) to handle
> the case when it is not, and not have to debug some far-flung runtime
> nullpointer exception (which will most assuredly happen the first time I
> demo the thing for my boss).

This is the job of the validating parser. By the time one has a JDOM 
Document in memory (read from somewhere) it will have those required
elements if you used such a parser and the doc was valid. 

For NoSuch*Exception, we are talking about documents which are 
known to be "well-formed" only as well as optional elements and attributes.


Patrick Dowler
Canadian Astronomy Data Centre

More information about the jdom-interest mailing list