tags:

views:

36

answers:

1
<Placemark id="p1"></Placemark>
<Placemark id="p2"></Placemark>
<Placemark id="p3"></Placemark>
<Placemark id="p4"></Placemark>

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

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

XPath is your friend :-)

prodigitalson