[jdom-interest] NoSuchAttributeException

Jason Hunter jhunter at collab.net
Wed Aug 30 16:44:53 PDT 2000

> Carey Boldenow wrote:
> I have an Element which may or may not contain a certain attribute.
> When I check for the value of this attribute i.e.
> elem.getAttribute("type").getValue() and it is not there, my program
> is throwing a null pointer exception. I have tried adding a
> NoSuchAttributeException to my catch block but my code will not
> compile. I have seen this exception somewhere in JDOM documentation.
> Has it been removed, if so, how can I do this.

The latest CVS code you're using has a different API than beta4.  The
list believed getAttribute() should return null if the elem is not found
instead of throwing an exception.  Same with getChild().  See the
archives for the long discussion.


More information about the jdom-interest mailing list