W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

Re: DOM - odd absent tag-setting method

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Mon, 21 May 2001 20:08:55 -0400
To: W3C DOM mailing list <www-dom@w3.org>
Message-ID: <OFB47BFA20.A4F781FD-ON85256A54.00001859@pok.ibm.com>

> 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:48 GMT