SimpleXML: Working with XML containing namespaces

后端 未结 3 565
猫巷女王i
猫巷女王i 2020-11-29 13:06

I am trying to get to the geo information off the google-picasa API. This is the original XML:


  
    35         


        
3条回答
  •  春和景丽
    2020-11-29 13:41

    This is how I did it without using xpath:

    $georss = $photo->children('http://www.georss.org/georss');
    $coords;
    if($georss->count()>0) {
        $gml = $georss->children('http://www.opengis.net/gml');
        if($gml->count()>0) {
            if(isset($gml->Point->pos)) {
                $coords = $gml->Point->pos;
            }
        }
    }
    

提交回复
热议问题