开发者

php xml SimpleXMLElement

<Placemark id="p1"></Placemark>
<Placemark id="p2"></Placemark>
<Placemark id="p3"></Placemark>
<Placemark id="p4"></Pl开发者_如何转开发acemark>

hi,im using SimpleXMLElement in my php, my question is,how do i get placemark id 3? is that something like this ?

$page = utf8_encode(file_get_contents($request_url));
$xml = new SimpleXMLElement($page);
$xml->Response->Placemark['id=p3']->AddressDetails->Country->CountryName;

thanks


$xml->xpath("Placemark[@id='p3']")->AddressDetails->Country->CountryName;

XPath is your friend :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜