Re: DOM - odd absent tag-setting method

> I just want to be able to pass empty elements into subroutines,
> have them filled (including tag), and then add
>the resulting elements to an XML doc.

Sorry, but that's not the way the API is designed; there's no such thing as
an empty Element Node.

Rearchitect to have the subroutines produce Elements rather than filling
them. You're probably going to have to do some of that anyway, if the data
requires that the element have content.

>subroutine should not have any knowledge of where the resulting
> XML is going in the big document.

It doesn't have to. Create the Element, return it, have the caller do the
insert/append operation. You do need to know which document the Element is
going to belong to (unless you're willing to recopy it with importNode),
but passing that information in is no harder than passing in the empty node
would have been if it existed.

>if they're actually different classes generated at runtime

In some DOMs they will be. For portability, we have to allow that.

______________________________________
Joe Kesselman  / IBM Research

Received on Monday, 21 May 2001 20:09:34 UTC