[jdom-interest] Re: NoSuch*Exception

Jean-Henri Duteau jeand at telusplanet.net
Thu Jul 13 10:56:34 PDT 2000


>Maybe the real point of contention is that I think not getting 
>something you ask for by name is an exceptional condition, similar to 
>trying to open a file that turns out not to exist; whereas some other 
>posters seem to feel that it's quite natural that something they ask 
>for by name wouldn't be there. That view just seems strange and alien 
>to me. As somebody else pointed out, if you really don't expect that 
>the child will be there when you ask for it, then what's needed is a 
>method to ask whether it exists.

You know, I've been sitting in the weeds watching the discussion.  If I had to vote (and I did on an earlier poll), I would have voted for returning null.  But Elliotte's point above suddenly hit me and I think (I'm not totally positive yet!) that Mr. Harold is actually right.  It appears to be too late since vote was taken, but the combination of Element.hasAttribute(String) and Element.getAttribute(String) throws NoSuchAttributeException might actually have been the wiser course.  AAGGHH, my whole worldview is falling to pieces around me!  I might have to retreat to my cubbyhole with the XPath recommendation and some oxygen!  AGGHH!! 8-)

Humour aside, I think Elliotte's point above is a very good and it's too bad that he didn't express it so clearly a week ago.

Jean




More information about the jdom-interest mailing list