[xml] "free" notifications

Hello all,

I think it might be useful to have a way how to notify the application using libxml2 that a node (or perhaps 
another object) is
about to be destroyed.
The notification receiver could be :
- document-wide (this would require extending the xmlDoc structure with pointer to the function)
- or global - this would perhaps work better for nodes with doc=NULL
- or combination, depending on the object type

The receiver would be a callback function equipped with the pointer to the destroyed object argument, and 
perhaps some additional
Perhaps it would also be useful if the receiver had the power to bypass actual destruction by a special 
return value.

This would primarily be used for removing wrapper objects whose underlying libxml2 objects are gone, in 
situations where the object
is internally destroyed and the caller cannot be sure (without duplicating the conditon evaluation, that is 
already present in the
libxml2 impl.) whether this happens or happened. And, there are such functions that work this way:
- xmlAddChild,
- xmlAddNextSibling,
- xmlAddPrevSibling  - in case that merging of text node happens (well, there is still the return value); 
also when adding attribute
that already exists (no way, app. has to pre-check before calling, for the name uniqueness)
- maybe also some other functions...

Any opinions ?


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