Usage of libxml2 for several modules

Nikolay Sivov bunglehead at gmail.com
Sat Jan 16 15:34:11 CST 2010


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.
>
>    
You're right. I spotted this some days ago while catching leaks reported 
by valgrind.
To block this feature which itself is good a deprecated IXMLElement API 
screws up
node type directly. This is a real problem speaking about leaks - 
libxml2 won't free node properly
after such intervention.

Related code is in xmldoc.c:
---
     node = xmlNewNode(NULL, empty);
     node->type = type_msxml_to_libxml(V_I4(&vType));
---

Proper way is to use xmlNewText, etc. Like we do it in DOM interfaces.

> > From http://xmlsoft.org/html/libxml-tree.html#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.
>    
Actually I posted a request in existing bug report here:
https://bugzilla.gnome.org/show_bug.cgi?id=427622

It's about what I'm started with - allowed parser depth.
Honestly I don't expect this change be accepted in libxml2 cause 
programs dependent on
exported global variable won't work as expected.

> I guess this would also be a vote for importing libxml2 (or at least
> forking it).
>
> Mike.
>    
Fork isn't needed actually, a bug fixing manual merge from time to time 
with off. repo will be enough.

Let's see Alexandre's opinion on this.



More information about the wine-devel mailing list