我用simpleXMLElement获取了一个xml文件,其中有一段是:
<event xsi:type="xslf:CardEvent" type="yellow_card" team="hosts">我现在想获取xsi:type= 后面的值,不知道该怎么做。说一下,请不要提示soap的做法,因为我整个程序是simpleXMLElement写的,而且用getNameSpaces()也可获取xsi的值,只是不知道xsi:type怎么取得。
谢谢
<event xsi:type="xslf:CardEvent" type="yellow_card" team="hosts">我现在想获取xsi:type= 后面的值,不知道该怎么做。说一下,请不要提示soap的做法,因为我整个程序是simpleXMLElement写的,而且用getNameSpaces()也可获取xsi的值,只是不知道xsi:type怎么取得。
谢谢
$xsiAtt = $eventsChildren->attributes($eventAtt[xsi]);
var_dump($xsiAtt[type]);
<root xmlns:xsi="http://xsi">
<event xsi:type="xslf:CardEvent" type="yellow_card" team="hosts"/>
</root>
XML;
$root = simplexml_load_string($xml);
echo (string) current($root->xpath('event/@xsi:type'));
结贴,给分了。。