[xml] Problem with xmlAddChild


I'm currently hacking on the lightspark project (free Adobe Flash
implementation), which uses libxml2 and libxml++. In ActionScript it is
possible to add nodes in reverse order, e.g.:
                var xml1:XML=new XML("<test1></test1>");
                var xml2:XML=new XML("<test2></test2>");
                var xml3:XML=new XML("<test3></test3>");

Now the problem is that xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
merges adjacent text nodes and cur is freed (making it impossible to add
something to cur later). It seems to work at first, but the memory gets
corrupted (surprise!). With libxml++'s import_node there is no
corruption, but the xml3-element doesn't get added at all.

Is there a possible workaround where the node structure doesn't get
touched by appendChild or do I have to re-implement that method (which
probably would require accessing the underlying structures directly and
hence be rather ugly).

Thanks in advance for your help.


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