I have this XML:
<JobReference> <Type>STANDARD</Type> <Title>N° ANCIEN DOSSIER</Title> <Reference/>
And am running this PHP code:
$xmljobreference = simplexml_load_string ($GetJobResult->JobReferences->JobReference->Title );    
$referenceanciendossier = $GetJobResult->JobReferences->xpath( "//JobReference[@Title ='N°  ANCIEN DOSSIER']/Reference" );
But I am getting this error:
Fatal error:call to undefined method stdClass::xpath() on line 190
If I run var_dump($GetJobResult) I get:
 public 'JobReferences' => 
    object(stdClass)[149]
      public 'JobReference' => 
        array (size=7)
          0 => 
            object(stdClass)[150]
              ...
          1 => 
            object(stdClass)[151]
              ...
          2 => 
            object(stdClass)[152]
             public 'JobSeq' => int 920179
				
                        
Well, as your
var_dumpshows you,JobReferencesis built up by aJobReferencewhich itself is an array with 7 items.So assuming that you want to run the xpath function on all the array items, you need to run a
foreachloop. Something like this should work: