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, PHP 8)
DOMNode::lookupNamespaceURI — プレフィックスに基づいて、ノードの名前空間 URI を取得する
関連する名前空間 URI を返します。
見つからなかった場合は null
を返します。
Simple way to get the URI of the default namespace:<?php $document = new DOMDocument(); $document->load($xml_file); $uri = $document->documentElement->lookupnamespaceURI(NULL);?>