Is there a non-deprecated alternative to xmlRegisterNodeDefault()?

Pacemaker (ClusterLabs > Pacemaker) uses xmlRegisterNodeDefault() and xmlDeregisterNodeDefault() to automatically create and free a private data structure (xmlNode:_private) at node creation and free time, respectively. I noticed today that they’re deprecated. Is there a non-deprecated alternative?

Unfortunately, there’s no drop-in replacement. You will have to populate the _private data manually after creating nodes or for a whole tree after parsing, and deallocate the data before freeing node trees.

The node registration API is badly designed and interferes with other users of libxml2 in the same process unless you’re extremely careful. That said, I won’t remove any API functions as long as they’re still used by popular open-source projects. But it would be great if you could move away from this API in the next years.