<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<GetListItemsResult>
<listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<rs:data ItemCount="2">
<z:row ows_ID='1' ows_MetaInfo='1;#vti_parserversion:SR|14.0.0.6134 ' />
<z:row ows_ID='2' ows_MetaInfo='2;#vti_parserversion:SR|14.0.0.6134 ' />
</rs:data>
</listitems>
</GetListItemsResult>
</GetListItemsResponse>
</soap:Body>
</soap:Envelope>
XML 字符串
我想得到的是ItemCount
来自rs:data
节点的属性
我正在尝试的是
$dom = new DOMDocument; $dom->loadXML( $result->data ); $xpath = new DOMXPath($dom);
$seats = $xpath->query('//rs:data[@ItemCount]'); print_r($seats);
请帮助,因为我是 Drupal PHP 的新手,可以通过正确的方式从该节点获取itemcount
属性值。rs:data
即使使用simplexml,我也尝试了很多方法,但都没有奏效,请分享代码片段
谢谢