[xml] xmlReader and _private


While implementing xmlReader wrapper for libxml++ I faced a little problem with the _private field of xmlNode. xmlReader implementation in libxml2 do use this field, and since we use it in libxml++ to store a pointer to a xmlpp::Node which is automatically instanciated in the xmlRegisterNodeDefault callback, it leads to a segfault when it is deleted in the xmlDeregisterNodeDefault callback.

I see 2 potential solutions to the problem :
1) Change libxml xmlreader implementation so it does not use _xmlNode._private. 2) Detect in the callbacks wether or not the node is created by xmlReader, and then don't do anything if it is the case. I would then implement Expand by copying the subtree to avoid some non wrapped nodes to be given to libxml++ user.

Is one of this options possible ? And if not is there any other way to solve this issue ?


Christophe de Vienne

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