SimpleXML's namespace support is far from ideal, IMHO. But as I don't know an easier solution right now, I don't complain too loud. One of the really missing features (and other people already complained about it) was the possibility to register namespaces/prefixes for xpath
operations. You had to either know, which prefix was used for which namespace in the original XML document, or make ugly queries (like â//*[local-name() = âfoo' and namespace-uri() = âhttp://foo.com/namespace/']â), especially if there was a default namespace defined⊠Until today, because I just committed a patch for adding
âregisterXPathNamespace($prefix,$namespaceURI)â to the SimpleXML extension. It works exactly the same as the same function in the DOMXPath class.
It will be available in PHP 5.1, or from CVS/Snapshots from now on.