PHP 8.3.4 Released!

DOMNode::lookupNamespaceURI

(PHP 5, PHP 7, PHP 8)

DOMNode::lookupNamespaceURI Получает URI пространства имён узла по префиксу

Описание

public DOMNode::lookupNamespaceURI(?string $prefix): ?string

Получает URI пространства имён узла на основе префикса prefix.

Список параметров

prefix

Префикс, который необходимо искать. Если этот параметр равен null, то метод возвращает URI пространства имён по умолчанию, если таковое имеется.

Возвращаемые значения

Возвращает URI связанного пространства имён или null, если оно не найдено.

Смотрите также

  • DOMNode::lookupPrefix() - Возвращает префикс пространства имён узла из URI пространства имён

add a note

User Contributed Notes 2 notes

up
7
lewar
16 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
13 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