Hello Rob, Tuesday, November 1, 2005, 11:49:22 AM, you wrote:
> 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. Right, i'll look into that, probbaly adding the with key "". > 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). Easy interface. If that leads to problems do it manually or use dom. Wans't that our standard answer? :-) > 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). Yes it is slow, i thought of the recursive useage only for debugging purpose. > I dont mind helping with the changes, but not sure exactly how and which > namespaces you want to pull. great - thanks marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php