Parse XML with Namespace using SimpleXML

前端 未结 6 961
独厮守ぢ
独厮守ぢ 2020-11-21 23:45

I have this as xml:


    
        &         


        
6条回答
  •  别跟我提以往
    2020-11-22 00:49

    it does work without registerXPathNamespace and the full namespace prefix in the xpath queries:

    $xml = new SimpleXMLElement($r);
    
    foreach($xml->xpath('//event:event') as $event) {
     var_export($event->xpath('event:sessionKey'));
    }
    

提交回复
热议问题