-1
我必须从指定坐标的xml数据中获取方向信息。这里是我的代码解析来自Google地图api的xml数据
<?php
$string= simplexml_load_file("http://maps.googleapis.com/maps/api/directions/xml?origin=37.036543,35.288086&destination=36.997415,35.288067&sensor=false");
print_r ($string);
$xml = new SimpleXMLElement($string);
$result = $xml->xpath('/WebServiceRequest/result[2]/message/text()');
while(list(, $node) = each($result)) {
echo 'b/c: ',$node,"\n";
}
?>
,但我得到了以下错误: 警告:的SimpleXMLElement :: __结构()的SimpleXMLElement .--构建]:实体:行4:分析器错误:开始标记预期, '<'找不到
当然还有其余的错误。
谢谢你的帮助。这很好。 – BKadmin 2013-05-09 12:06:09