Marcus,
There are a few problems with this approach. A crash will occur if
adding a default namespace as there is no prefix.
The namespace should probably be the key and prefix the value or default
namespaces should not be added.
When doing a recursive get, if the namespace is redefined further down
in the subtree, the redefinition is what ends up in the array rather
than the closest namespace to the element. Just to be clear this also
only adds namespaces that are used, not those defined but not used
(which is probably ok with how they are used in SimpleXML).
When calling getDocNamespaces recursively, if there are any
redefinitions in the tree, what ends up in the array all depends upon
the LAST node that get processed by the sxe_add_registered_namespaces
function.
- probably better to do this one manually and walk the elements in the
tree checking the nsDef and adding them. Will be faster - one tree
traversal rather than multiple times (it ascends the entire tree every
time right now starting from the position of the node passed to
xmlGetNsList - which is a killer when called recursively).
I dont mind helping with the changes, but not sure exactly how and which
namespaces you want to pull.
Rob
Marcus Boerger wrote:
helly Mon Oct 31 14:09:13 2005 EDT
Added files:
/php-src/ext/simplexml/tests 025.phpt
Modified files:
/php-src/ext/simplexml simplexml.c
Log:
- Add functions to check for registered/in use namespaces
http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.170&r2=1.171&ty=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.170
php-src/ext/simplexml/simplexml.c:1.171
--- php-src/ext/simplexml/simplexml.c:1.170 Sun Oct 30 15:37:07 2005
+++ php-src/ext/simplexml/simplexml.c Mon Oct 31 14:09:10 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php