Simple way to get the URI of the default namespace:
<?php
$document = new DOMDocument();
$document->load($xml_file);
$uri = $document->documentElement->lookupnamespaceURI(NULL);
?>
(PHP 5, PHP 7)
DOMNode::lookupNamespaceUri — Gets the namespace URI of the node based on the prefix
$prefix
) : string
Gets the namespace URI of the node based on the
prefix
.
prefix
The prefix of the namespace.
The namespace URI of the node.
Simple way to get the URI of the default namespace:
<?php
$document = new DOMDocument();
$document->load($xml_file);
$uri = $document->documentElement->lookupnamespaceURI(NULL);
?>