Re: DOM - odd absent interface method?

> it can be very
>expensive to create a new node, migrate children & attribute nodes of
>the original, and the replace the original with the new node.

Shouldn't be, in most cases, unless you have a huge number of children or
perform this operation extremely frequently. More expensive than just
changing the node name, granted. But part of the tradeoff one accepts for a
portable API is that it may have been forced to accept compromises which
make it less than ideal for some tasks.

>  It also makes the code more difficult to read and maintain.

Shouldn't be, if you write a subroutine which performs this operation and
invoke that. (Note too that this subroutine might be able to check whether
you're working with a DOM implementation which has a custom feature for
this purpose, and leverage that, without the rest of your code having to be
aware of it... while still retaining the explicit replace-the-node solution
for other DOMs.)



______________________________________
Joe Kesselman  / IBM Research

Received on Monday, 21 May 2001 10:18:15 UTC