0) { return substr($s, $c + 1); } return $s; } /** * Get namespace from a tag name. * * Example: input is "topp:the_geom" will return "topp". * * @return String * @param $s String */ final protected function getNameSpace($s) { $c = strpos($s, ":"); if ($c > 0) { return substr($s, 0, $c); } return $s; } /** * Retrieves a document from a URL, presumably a * capabilities document, via GET. * * @return String * @param $url String */ final protected function get ($url) { $x = new connector($url); $xml = $x->file; if(!$xml){ throw new Exception("Unable to open document: " . $url); return null; } return $xml; } /** * Retrieves a document from a URL, presumably a * describe feature type document, via POST * * @return String * @param $url String */ final protected function post ($url, $postData) { $x = new connector(); $x->set("httpType", "post"); $x->set("httpPostData", $postData); $x->set("httpContentType", "XML"); $xml = $x->load($url); if(!$xml){ throw new Exception("Unable to open document: " . $url); return null; } return $xml; } /** * Creates an OWS from an XML, presumably a capabilities document, * which is retrieved from a URL. * * @return Ows * @param $url String */ final public function createFromUrl ($url) { try { $xml = $this->get($url); $myOws = $this->createFromXml($xml); if ($myOws != null) { $myOws->uploadUrl = $url; return $myOws; } return null; } catch (Exception $e) { new mb_exception($e); return null; } return null; } } ?>