What should I use instead of the deprecated xmlSetFeature?

xmlSetFeature() is legacy and recently deprecated and disabled by default. My application calls it to enable the “gather line info” feature. I don’t see another way to enable that feature. What should I call, or is that feature deprecated, too?

@nwellnhof I would appreciate your thoughts on this.

Have a look at the implementation: https://gitlab.gnome.org/GNOME/libxml2/-/blob/master/legacy.c#L270

In your case, use ctxt->record_info = 1

This should actually be a parser option, see https://gitlab.gnome.org/GNOME/libxml2/-/issues/428

But for now, setting record_info directly is the best solution.

Thanks for the reply, Nick. I assumed the context was intended to be private and my app shouldn’t poke inside it. I agree, there should be an API. Thanks for opening that issue.

In general, yes, you should treat the context struct as private. It’s a huge design mistake that this struct and others are public. Unfortunately, there are still a few use cases where you have to access struct members directly. I hope to get this sorted out eventually, so thanks for the input.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.