PHP使用simpleXML解析georss命名空间

试图解析谷歌地图RSS Feed中的lat / lon:
$file = "http://maps.google.com/maps/ms?ie=UTF8&hl=en&vps=1&jsv=327b&msa=0&output=geoRSS&msid=217909142388190116501.000473ca1b7eb5750ebfe";
$xml = simplexml_load_file($file);    
$loc = $xml->channel->item;
echo $loc[0]->title;
echo $loc[0]->point;

标题显示好,但点没有给我任何东西.每个节点如下所示:

<item> 
    <guid isPermaLink="false">0004740950fd067393eb4</guid> 
    <pubDate>Sun,20 Sep 2009 21:47:49 +0000</pubDate> 
    <title>Big Wong King Restaurant</title> 
    <description><![CDATA[<div dir="ltr">$4.99 full meals!</div>]]></description> 
    <author>neufuture</author> 
    <geoRSS:point> 
      40.716236 -73.998413
    </geoRSS:point> 
    <geoRSS:elev>0.000000</geoRSS:elev> 
  </item>
尝试这个:
<?PHP 
    $file = "http://maps.google.com/maps/ms?ie=UTF8&hl=en&vps=1&jsv=327b&msa=0&output=geoRSS&msid=217909142388190116501.000473ca1b7eb5750ebfe";
    $xml = simplexml_load_file($file);  
    $loc = $xml->channel->item;  
    foreach ($loc->children('http://www.geoRSS.org/geoRSS') as $geo) { 
        echo $geo;
    } 
?>

结帐这个Zend article for working with namespaces in XML

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...