Hello Rob,

Tuesday, November 1, 2005, 12:59:02 PM, you wrote:

> Marcus Boerger wrote:

>>>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? :-)
>>  
>>
> Works for me and also answers previous question on redefining default 
> namespace.

I added code to add default namespaces as "" now, looks good, see the test.

>>>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.
>>  
>>
> Concern here wasnt as much about speed as you had mentioned it was only 
> for debugging, but that a node buried in a document can alter the 
> returned namespace array can make debugging a bit harder. I am going to 
> change it to search manually which not only will increase speed, but the 
> results will be consistent. Since the prefix is going to remain as the 
> array key, imo it's probably best if the first encountered namespace in 
> document order is used and any dupe prefix skipped.

Ah, skipping dups makes sense in the recursive mode.

marcus

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to