Parse XML with Namespace using SimpleXML

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

I have this as xml:


    
        &         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 00:28

    Using registerXPathNamespace and then calling xpath didn't actually work for me. I had to go with the solution provided in this great post : http://blog.preinheimer.com/index.php?/archives/172-SimpleXML,-Namespaces-Hair-loss.html

    So in your case, this :

    echo $xml->children('http://www.webex.com/schemas/2002/06/service/event')->sessionName;
    

    Will output:

    Learn QB in Minutes

提交回复
热议问题