I\'m writing a script which reads and manipulates a KML (xml) document. Below is a snippet of the document I\'m reading:
load('file.xml'); // returns true
$xp = new DOMXPath($doc);
$xp->registerNamespace('ge', 'http://earth.google.com/kml/2.2');
$places = $xp->query("//ge:Placemark");
echo $places->length; // --> 0 ??!!??
$everything = $xp->query("//*"); // (so I know that the XPath isn't fully borked)
//echo $doc->saveXML();
Apparently you have to register the 'ge' namespace and query it as such, at least this is what I came up with after a few minutes googling. I guess sometimes we forget we're dealing with namespaces :p