One piece I cut out was a bit of code to go through the cloned tree and
remove all "id" attributes. However, this didn't appear to make much
difference. I'll make a few changes to get rid of the duplicated "id"
attributes and see if it changes things.
Thanks
-Evan
-----Original Message-----
From: Bill Schindler [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 13, 2001 1:25 PM
To: [EMAIL PROTECTED]
Subject: Re: DOM_Node::cloneNode() clones not getting released?
On Friday, April 13, 2001, at 11:33 AM, Day, Evan wrote:
> Code snippet begins here:
>
> DOM_Element row = thePage.getElementById("template");
>
> DOM_Node table = user_row.getParentNode();
>
> for(int i = 0; i < len; i++) {
>
> setTextById("cell1", cell1_data);
> // basically does an
> DOM_Node::appendChild(DOM_Document::createTextNode(cell1_data))
> setTextById("cell2", cell2_data);
> setTextById("cell3", cell3_data);
> DOM_Node clone = row.cloneNode(true);
> table.appendChild(clone);
> }
>
> table.removeChild(row);
It looks like your code is doing something that Xerces allows at
one point and disallows in another. What you are doing is
technically illegal. An ID is supposed to be a document unique
value, yet the clone and append produces multiple nodes with
identical ID values.
What happens is that NodeIDMap assumes that non-unique ID values
will never be passed in, so it (quite deliberately) never checks
for duplicates.
I'd say that that both your code _and_ Xerces has a bug. Your bug
is that you are creating a document with duplicate IDs. Xerces' bug
is that it's allowing that. (There's even code in AttrImpl to
support cloning an ID attr!)
--Bill
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]