doubaisui2526 2015-06-16 14:43
浏览 273

警告:simplexml_load_string()期望参数1为str​​ing,给定数组

I have this error :Warning: simplexml_load_string() expects parameter 1 to be string, object given in on line 195

and also this error: Fatal error: Call to a member function xpath() on a non-object in C:\wamp\

so my code in following :

foreach ( $GetJobResult->JobReferences as $jobreference_index => $JobReferences ) {
            if (isset ( $GetJobResult->JobReferences )) {

                $xmlJobReference = simplexml_load_string ( $JobReferences );

                $JobReferencetitle = $xmlJobReference->xpath ( "//JobReference[Title ='N°  ANCIEN DOSSIER']/Reference" );


                var_dump($GetJobResult->JobReferences);

            }
        }

var_dump($GetJobResult->JobReferences);

object(stdClass)[149]
  public 'JobReference' => 
    array (size=7)
      0 => 
        object(stdClass)[150]
          public 'Type' => string 'STANDARD' (length=8)
          public 'Title' => string 'N° cde client' (length=14)
          public 'Reference' => string '' (length=0)
          public 'ValueType' => string 'ALPHANUMERIC' (length=12)
          public 'ValueLength_Minimum' => int 0
          public 'ValueLength_Maximum' => int 20
      1 => 
        object(stdClass)[151]
          public 'Type' => string 'STANDARD' (length=8)
          public 'Title' => string 'N°  ANCIEN DOSSIER' (length=19)
          public 'Reference' => string '' (length=0)
          public 'ValueType' => string 'NUMERIC' (length=7)
          public 'ValueLength_Minimum' => int 0
          public 'ValueLength_Maximum' => int 6
  • 写回答

2条回答 默认 最新

  • doucaigai7176 2015-06-16 15:00
    关注

    simplexml_load_string transforms string to SimpleXmlElement. You are passing object. Thats the problem.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大