Re: Can SimpleXML still return all namespaces?
| From: | Rob Richards | Date: | Thu, 19 Jul 2007 12:20:57 +0000 |
| Subject: | Re: Can SimpleXML still return all namespaces? | ||
| References: | 1 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-597@lists.php.net to get a copy of this message | ||
Answering some of these questions on this list in case anyone else has some opinions/input on them.
I was also interested in the behaviour described in _http://www.onlamp.com/pub/a/php/2004/01/15/simplexml.html?page=2_ of a beta version of SimpleXML. It seems to me that this would be quite useful, despite the risks. And if you know the details of the documents you are dealing with, you can evaluate the risks anyway. The upshot of all this is that I think a solution to all these problems could be defining two new methods: setElementNamespaceMode($ns,$is_prefix) setAttributeNamespaceMode($ns,$is_prefix) This would set the namespace for all lookups, iterations, etc. 'from that point onwards'.This is exactly the purpose of the children() and attributes() methods. They are used to set a namespace scope to work within.
The behaviour I want could be signalled by passing some constant that evaluates to an internal, illegal namespace name. The current behaviour could be signalled by set...NamespaceMode('',true) to check for an empty prefix (or another constant). . . .So what you are proposing is just a way to be able to work with SimpleXML in a completely namespace ignorant way? Basically, ignore all namespaces/prefixes and work directly with local names only? Rob