Re: Element interface

>Consequence:  When coding the API I cannot easily use a NamedNodeMap
>to store the attributes of an element.  Well, I can catch the
>exception, but that is neither elegant nor fast.

That's one solution. If we assume that removing a nonexistant attribute is
an uncommon action -- which is probably true -- performance is probably not
a major concern; you only pay a penalty if the exception must be thrown and
caught.

Another approach is to check whether the named item is present in the
NamedNodeMap before you remove it.

Another approach is to provide yourself with a private mechanism that
doesn't throw the exception. What a DOM implementation publishes to the
outside world, and what it looks like internally, may be very different
things.


There are existing Level 1 DOM implementations that handle this case
successfully. "If it happens, it must be possible."

______________________________________
Joe Kesselman  / IBM Research

Received on Tuesday, 7 March 2000 08:29:27 UTC