Re: [xml] xmlRemoveID patch



From: Daniel Veillard
  and I don't want that behaviour when streaming.
When streaming I don't want the ID to be removed from the table by that
function.
I want the attribute it reference to be NULLed and the id kept in the
table so that validation checking works in streaming mode too.

The only way I can see this working is that xmlTextReaderFreeProp calls a
different function than xmlRemoveID, or adding an additonal parameter, which
is probably not a good thing to do if people are using it - though I still
say it never worked ;). If you dont need the reference to the attribute,
though I believe you would since someone could call xmlGetID while the
element was still in scope which would return NULL, I am not sure wether
xmlAddID could be fixed to test for this streaming condition as currently
its test: ctxt->vstateNr != 0 fails.

I tweaked that patch a bit and changed the line where it removes the ID from
the hash to just cur->attr = NULL;

That test works fine that way. No leaks, no segfaults. This really isnt the
desired behavior however when not streaming, as it should remove the IDPtr
and not just remove the reference between the IDPtr and AttrPtr, which is
why I suggest either an additional function or just remove that block in
xmlTextReaderFreeProp which was added last week (if the patch had been
submitted before 9/27, the tests would have passed).

Rob





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