$xml = ''; $element = new SimpleXMLElement($xml); $namespaces = $element->getNamespaces(); print_r($namespaces); // Array ( [foo] => http://example.com/foo )
$xml = 'This example creates an XML document with a root element that has a default namespace "http://example.com". The getNamespaces() method is then used to retrieve the URI of the default namespace. Package/library: PHP Standard Library'; $element = new SimpleXMLElement($xml); $namespaces = $element->getNamespaces(); print_r($namespaces); // Array ( [0] => http://example.com )