You have to pass *null* to lookupNamespaceURI if you want to read the default namespace. Passing an empty string doesn't work - even though the documentation says that lookupNamespaceURI takes a string as argument (and null would just be converted to an empty string).
DOMNode::lookupNamespaceURI
(PHP 5)
DOMNode::lookupNamespaceURI — İsim alanı öneki belirtilen düğümün isim alanı betimleyicisini döndürür
Açıklama
string DOMNode::lookupNamespaceURI
( string
$önek
)
İsim alanı öneki önek ile belirtilen düğümün isim
alanı betimleyicisini döndürür.
Değiştirgeler
-
önek -
İsim alanı öneki.
Dönen Değerler
İsim alanını betimleyen adres.
Ayrıca Bakınız
- DOMNode::lookupPrefix() - Belirtilen isim alanıyla ilişkili düğümün isim alanı önekini döndürür
_ michael
30-Apr-2010 02:22
lewar
05-Jun-2007 05:20
Simple way to get the URI of the default namespace:
<?php
$document = new DOMDocument();
$document->load($xml_file);
$uri = $document->documentElement->lookupnamespaceURI(NULL);
?>
