I use geoPhp and domDocument to parse (or write) gpx or kml files.
First, thank you for this great API !
It would be great to allow direct use of domNode in geomFromText methods (for xml formats).
Currently, my classes transform a domNode into a string to be able to use geoPhp geomFromText but this method transform this string into domNode again
I propose this replace in geomFromText methods :
Replace
// Change to lower-case, strip all CDATA, and de-namespace
$text = strtolower($text);
$text = preg_replace('/<!\[cdata\[(.*?)\]\]>/s','',$text);
// Load into DOMDOcument
$xmlobj = new DOMDocument();
@$xmlobj->loadXML($text);
if ($xmlobj === false) {
throw new Exception("Invalid GeoRSS: ". $text);
}
$this->xmlobj = $xmlobj;
with
if(is_string($text)){
// Change to lower-case and strip all CDATA
$text = mb_strtolower($text, mb_detect_encoding($text));
$text = preg_replace('/<!\[cdata\[(.*?)\]\]>/s','',$text);
// Load into DOMDOcument
$xmlobj = new DOMDocument();
@$xmlobj->loadXML($text);
if ($xmlobj === false) {
throw new Exception("Invalid KML: ". $text);
}
$this->xmlobj = $xmlobj;
}
else if(is_object($text))
$this->xmlobj = $text;
else
return false;
I use geoPhp and domDocument to parse (or write) gpx or kml files. First, thank you for this great API !
It would be great to allow direct use of domNode in geomFromText methods (for xml formats). Currently, my classes transform a domNode into a string to be able to use geoPhp geomFromText but this method transform this string into domNode again
I propose this replace in geomFromText methods :
Replace
with