Hi,
here is a code I tested. After removing a child from the DOM tree, I try
to free the child from memory.
---------- destroy.tcl
package require dom
set doc [dom::DOMImplementation create]
set root [dom::document createElement $doc top]
set node1 [dom::document createElement $root node]
set node2 [dom::document createElement $root node]
puts $node1
dom::node removeChild $root $node1
dom::DOMImplementation destroy $node1
puts [dom::DOMImplementation serialize $doc]
-------
That doesn't work at all! The following error message is displayed on
my shell:
::dom::document1(node4)
invalid token "::dom::document1(node1)"
while executing
"GetHandle documentFragment [lindex $args 0] node"
("serialize" arm line 7)
invoked from within
"switch -- $method {
hasFeature {
if {[llength $args] != 2} {
return -code error "wrong number of arguments"
}
# Later on, could u..."
(procedure "dom::DOMImplementation" line 5)
invoked from within
"dom::DOMImplementation serialize $doc"
invoked from within
"puts [dom::DOMImplementation serialize $doc]
"
(file "destroy.tcl" line 13)
Do I use the destroy function correctly ?
Thanks for your help.
Sreng.
|