Re: [libxml++] Proposition: nodes manipulation



Stefan Seefeld a écrit :

Christophe de Vienne wrote:

Currently, the lifetime of nodes is controlled by libxml2, via callbacks on node ceation/deletion. The restrictions are that we cannot create a standalone node, nor detach and then delete a node like a normal class instance.


Why do you believe this is a restriction ? Being able to unlink a node
from its document will open up a big can of worms. Not only will you
have to deal with resource allocation issues (until now nodes are owned
and thus taken care of by a document), but there are other issues such
as context data that are required for the node to make sense. Just think
about namespaces.


I see what you mean. In my mind the restriction is compared to what libxml2 proposes. Any issues with context datas are already adressed by libxml2, and ressource allocation issues could eventually be solved with smart pointers (cf my other post).


Sometimes it's better for an API to make it hard (if not impossible)
for users to do certain things, just because there are better ways
to achieve what they want.


That why I want to discuss this API change. I'm not 100% sure it worth it (let's say I'm around 75% :-), but I'm sure it worth a try. I think being able to construct a subtree independently from the final tree is interesting.

Regards,

Christophe





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