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.