简体   繁体   English

XML-如何获取名称空间标签名称?

[英]XML - how to get namespace tag name?

$xml = simplexml_load_file("URL");

$namespaces = $xml->getNamespaces(true);

i'm getting the namespaces for like this 我正在得到这样的命名空间

Array
(
    [aaa] => http://www.aaa.com/rss/module/save/1.0.2
    [dc] => http://bbb.org/dc/elements/1.1/
)

i need the name for (aaa,dc) 我需要(aaa,dc)的名称

How to get the namespaces name? 如何获取名称空间名称?

$xml = simplexml_load_file("URL");

$namespaces = $xml->getNamespaces(true);

// loop through the namespaces and echo them out
foreach($namespaces as $name => $value)
{
    echo 'namespace: ' . $name;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM