[xml] xmlAddChild() vs. xmlAddChildList()



Hi, 

Suppose I have a number of children-nodes attached to a parent. Suppose I take one of these children-nodes 
and add it to another parent. I would expect the behaviour of xmlAddChild() and xmlAddChildList() to differ 
in this respect, such that xmlAddChild ONLY adds this particular child, and xmlAddChildList adds this 
particular child and all other nodes attached to this child via 'next'. 

But it doesn't. Look at the next gdb()-output:


Breakpoint 1, updateRecord (main=0x8051d00, new=0x8059240, PR=3)
    at onixmerge.c:293
293           child = xmlAddChild (main, new);
(gdb) print *new  
$1 = {_private = 0x0, type = XML_ELEMENT_NODE, name = 0x8054e40 "UPC", 
  children = 0x8059280, last = 0x8059280, parent = 0x8059040, 
  next = 0x80592c0, prev = 0x8059200, doc = 0x8053380, ns = 0x0, 
  content = 0x0, properties = 0x0, nsDef = 0x0}
(gdb) until
295     }
(gdb) print *child
$2 = {_private = 0x0, type = XML_ELEMENT_NODE, name = 0x8054e40 "UPC", 
  children = 0x8059280, last = 0x8059280, parent = 0x8051d00, 
  next = 0x80592c0, prev = 0x805ddc0, doc = 0x8053300, ns = 0x0, 
  content = 0x0, properties = 0x0, nsDef = 0x0}
(gdb) 


AddChild() in line 293 takes 'new', which has a node attached to it via 'next' (address = 0x80592c0). After 
the AddChild()-node, the 'next' is left intact, although the parent and prev have (correctly) changed. 

Is my understanding of the difference between AddChild() and AddChildList() wrong, or not? Bug or feature?

Kind regards from sunny Amsterdam,

Roelant.



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