I am using the DOM extension to parse an xml file containing xml namespaces. I would have thought that namespace declarations are treated just like any other attribute, but
Note, that
echo $root->getAttributeNode('xmlns')->nodeValue . "\n";
echo $root->getAttribute('xmlns') . "\n";
echo $root->getAttribute('xmlns:syn') . "\n";
all work as expected, and print out
http://purl.org/rss/1.0/
http://purl.org/rss/1.0/
http://purl.org/rss/1.0/modules/syndication/
because DOMNameSpaceNode is a Node, not a NodeCollection.
Just clarifying, that, unless something in PHP DOM extension changes, XPath (as explained by VolkerK) is the only native way to get all the namespaces, regardless of documentation.