21,887
社区成员
发帖
与我相关
我的任务
分享
$str = <<<XML
<db:root xmlns:db="http://www.w3.org/2001/XMLSchema">
<db:attribute name="isbn10">7543639130</db:attribute>
<db:tag count="15" name="片山恭一" />
</db:root>
XML;
$xml = simplexml_load_string($str, NULL, 0, 'db', true);
foreach($xml->attribute[0]->attributes() as $key=>$value)
{
echo $key .":".$value."<br/>";
}
echo $xml->attribute[0] . "<br/>";
foreach($xml->tag[0]->attributes() as $key=>$value)
{
echo $key .":".$value."<br/>";
}
echo $xml->tag[0];