Memory allocated to a DOM document is released when the last handle
(DOMDocument object) to the documentimplementation dies. If you need to
alter the document tree then you want to use the DOM_Node::removeChild
method.

  roObsoleteNode = 0; // Only closes the handle to the implementation of the
obsolete node
  roParentNode.removeChild(roObsoleteNode); // Removes the obsolete node
from the DOM tree

The actual memory of the obsolete node is not released until the document
dies.
There is no way for you to remove it earlier.

Regards

Erik Rydgren
Mandarinen systems AB
Sweden

-----Original Message-----
From: Pat O'Neil [mailto:[EMAIL PROTECTED]]
Sent: den 23 november 2001 14:17
To: [EMAIL PROTECTED]; Juergen Hermann
Subject: RE: Deleting objects from the DOM


Thanks, but I guess I have a more specific question for your vague answer...

Say I DOMParse and load an existing XML doc, then want to delete an Element,
and any of it's associated child nodes, how would I do it?  Do I simply find
the node of type DOM_Element and assign it =0?  Or must I assign 0 all the
ancestors first?  When you say 'free all memory associated with node' does
this include children?

Thanks again
Pat

-----Original Message-----
From: Juergen Hermann [mailto:[EMAIL PROTECTED]]
Sent: 23. marraskuuta 2001 12:24
To: Pat O'Neil; [EMAIL PROTECTED]
Subject: Re: Deleting objects from the DOM


On Fri, 23 Nov 2001 11:57:55 +0200, Pat O'Neil wrote:

>       I have found no documentation that describes deleting a DOM_Node (and
>possibly its children) from the heap.  Have I missed reviewing a piece of
>sample code, or should I try grabbing pointers and deleting them, or a
third
>more intelligent alternative that I cannot fathom?

DOM_Node node;
...
node = 0; // free all memory associated with node





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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to