On 1/17/2010 00:11, Mike Kaplinskiy wrote:
While we're on the subject of libxml2, there is a small problem with the way we use xmlAddChild. msxml doesn't automatically coalesce text nodes when two are next to each other in the tree and keeps them as two separate entities (you call normalize to coalesce them). libxml2 does this automatically when doing xmlAddChild.
Add a new node to @parent, at the end of the child (or property) list merging adjacent TEXT nodes (in which case @cur is freed)
Which means we can potentially have disappearing nodes. Should I also file a feature request to have the auto coalescing be toggleable? I don't think there is any good way of solving this ourselves.
After some digging I think we could use xmlNewTextChild to create text nodes. This will prevent coalescence and leave a new added node as is. New type will be XML_ELEMENT_NODE though, so it's a partial solution cause type not preserved.