DOMNode::lookupNamespaceURI

(PHP 5, PHP 7)

DOMNode::lookupNamespaceURI Gets the namespace URI of the node based on the prefix

설명

public string DOMNode::lookupNamespaceURI ( string $prefix )

Gets the namespace URI of the node based on the prefix.

인수

prefix

The prefix of the namespace.

반환값

The namespace URI of the node.

참고

add a note add a note

User Contributed Notes 2 notes

up
7
lewar
17 years ago
Simple way to get the URI of the default namespace:

<?php
    $document
= new DOMDocument();
   
$document->load($xml_file);
   
$uri = $document->documentElement->lookupnamespaceURI(NULL);
?>
up
-5
_ michael
14 years ago
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).
To Top