0
<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
  • 1
    you have id=3 in your PHP code, but id="p3" in your XML. I don't know if this is causing you problems. Commented Mar 30, 2010 at 14:14

1 Answer 1

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

XPath is your friend :-)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.