Re: [xml] non-unique attr handling in xmlAddChild()

On Thu, Nov 04, 2004 at 12:41:40PM +0100, Lars Oppermann wrote:
Hi folks,

I belive, that the handling of Attributes given to xmlAddChild is wrong 
in case an attribute with the same name already exists at the parent 
node [1].

When a property (attribute) with the same name is found, it is freed and 
the new prop node is appended to the end of the property list. If I 
understand matters correctly, the old property is just freed from 
wherever it was in the prop list, leving it's peers with dangling 
references to the old property.
Since the new prop is appended to the end, this would only work if the 
property with the same name was found right at the end of the list.

I think that either a call to xmlRemoveProp(... lastattr) or the 
transfer of cur's content to lastprop, freeing cur and stting 
cur=lastprop for return would be the way to go.
I belive the latter approach would be better, since it would leave other 
references to lastprop intact.

Or am I just missing something?

  Can you send a contextual diff of what you are suggesting so I better
understand what you suggest ?



Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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