Re: [xml] Some things about xmlCharEncodingHandler



oliverst online de wrote:
I just recognised a problem with my patch.
It gives you the handler, that already exists under the alias you want
to register it, but what if you wnat to use different callbacks than the
already registered one? The result you are going to get is not the one
you expected. But on the other hand you were never able to overwrite an
existing handler with old code or use a different handler under the same
alias with different callbacks, because xmlFindCharEncodingHandler()
always gave you the first it found.
So...the question is, how should the function behave?

With my patch it would just look for an existing handler with the same
alias. Should it also change the callbacks from the existing ones to the
ones you passed in the function call, if they aren't the same?

It seems so.

Might this cause some problems, if you just change the callbacks 
while libxml2 might be in use? I am not sure how it is protected or 
sync'd internally. Because if somebody is using the handler while you 
change it might use the first callback, which still be the old one 
and then the second callback, which is already the new one. Would be 
a bad thing IMO.

So long
Oliver



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