Re: [xml] redicting parts of trees


On Thu, 2005-05-19 at 20:37 +0200, Martijn Faassen wrote:

Replying to myself:

Martijn Faassen wrote:

But now I wonder: does this only apply to attribute nodes, or also to 
element nodes which are in a subtree? Testing this.. Ugh, yes, it does. 
When I move a namespaced element (where the namespace is defined higher 
in the tree) into another tree, and then subsequently remove the 
original tree, things go way wrong and valgrind indeed points to a 
reference to a libxml2 namespace structure that has since been removed. 
Not good...

But thanks for pointing this issue out to me!

I've since fixed this in lxml by employing xmlReconciliateNs. It'd be 

Ah, you already did add xmlReconciliateNs.

nicer if there was a proper adoptNode() functionality that took care of 
this as well (preferably in a single walk through the tree :), though I 

Yes, 1 walk is better than 2.

guess this problem also applies to nodes moving *within* trees..

Yes, for which you can use xmlReconciliateNs as well.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]