|
From: | Fred Kiefer |
Subject: | Libxml2 versions and namespaces |
Date: | Wed, 21 Mar 2012 10:43:32 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2 |
As I explained in my reply to Riccardo, these checks may not be sufficient, if the header files don't match the installed library. If this turns out to be a real issue, we may need to add more configure tests for specific libxml2 features.
When I did this change I was also right in the middle of an attempt to add support for namespaces. The code still passes all current test cases for me. (But not my local tests for namespaces :-() This may not be that case on other systems, please report back whether I introduced new issues with other versions of libxml2.
Namespaces turn out to be rather complicated to add to the NSXML classes. There we are able to create attributes and elements with a prefixed name even when there isn't a namespace definition for that prefix. In that case we need to store a temporary namespace definition somewhere and later replace it with the real one. I have a few ideas here, but implementing them turns out to be rather complicated. And we also need to support the case where we have the href but no prefix...
This also led me to rethink the memory management for namespace NSXMLNodes. The same libxml2 node for a namespace could be used in different places in an XML tree, we don't have a chance to take over the memory management here, as we did with normal nodes that are only allowed in one place in the tree. I think the best we can do here is copy the namespace node each time we move between the libxml2 world and our NSXML world. Otherwise we could end up referencing freed nodes or leaking nodes. I haven't implemented that, but this bit seems simple and the slow down for not caching the object for a namespace node should be minimal.
Fred
[Prev in Thread] | Current Thread | [Next in Thread] |