Hi fellow coders 🙂
Im pulling som info out of a sharepoint list via SOAP, that works like a charm, and i get this XML:
<?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="84">
<z:row ows_SelectedFlag='0' ows_DocIcon='jpg' ows_NameOrTitle='test pic.JPG' ows_ImageSize='113' ows_FileSizeDisplay='4459' ows_RequiredField='testweb/test pic.JPG' ows__ModerationStatus='0' ows__Level='1' ows_ID='34' ows_owshiddenversion='3' ows_UniqueId='34;#{3F913197-5568-4301-B6F8-F244C5658FC5}' ows_FSObjType='34;#0' ows_Created_x0020_Date='34;#2009-12-03 09:22:16' ows_ProgId='34;#' ows_FileLeafRef='34;#test pic.JPG' ows_Modified='2009-12-03 09:23:03' ows_FileRef='34;#testweb/test pic.JPG' ows_Editor='47;#Administrator' ows_MetaInfo='34;#Stilling:SW|admin-post
vti_parserversion:SR|12.0.0.6504
Fornavn:SW|testeren
ContentTypeId:SW|0x01010900B27BFA61034E284192E402A61B17412C006C68C283719D3A4985744DAEC6B182D8
Initialer:SW|TsT
ContentType:SW|MaxContent
vti_lastheight:IX|170
Efternavn:SW|Testefternavn
vti_author:SR|Testdomain\\admin
vti_lastwidth:IX|113
vti_modifiedby:SR|Testdomain\\admin
Email:SW|test@test.com
' ows_Last_x0020_Modified='34;#2009-12-03 09:23:03' />
</rs:data>
</listitems></GetListItemsResult></GetListItemsResponse></soap:Body></soap:Envelope>
There are more <z:row, 84 in fact, but no need to paste them all here 😃
And then comes the trouble, i just cant seem to get any of the informations out of it, using DOM.
Im using this:
$doc = new DOMDocument();
$doc->loadXML($myxml);
$all = $doc->getElementsByTagName( "row" );
foreach( $all as $one )
{
$info = $one->getElementsByTagName("ows_DocIcon");
$output = $info->item(0)->nodeValue;
echo $output;
}
Comes into foreach 84 times, so that seems to work, but i only get this error:
Notice: Trying to get property of non-object in XXX on line 74
Im green in using xml with php.. What am i missing?
Kind regards
Morten