Fikio getDocNamespaces() mifano

定义和用法

getDocNamespaces() 函数从 SimpleXMLElement 对象返回在 XML 文档中声明的命名空间。

如果成功,该函数返回包含命名空间名称(带有关联的 URL)的数组。如果失败,则返回 false。

语法

class SimpleXMLElement
{
string getDocNamespaces(recursive)
}
参数 描述
recursive 可选。规定是否返回父子节点中的所有命名空间。默认是 false。

实例

XML 文件:



George
John
Reminder
Don't forget the meeting!

PHP 代码:

$xml->getDocNamespaces());
?>

输出类似:

Array
(
[b] => http://www.codew3c.com/example/
)