src/XSD2PHP/src/com/mikebevz/xsd2php/wsdl/AbstractWsdl.php
public function getSchemaLocation($ns)
    {
        if ($this->getSchemasPath() == null) {
            throw new \RuntimeException("Schemas path is not specified - cannot start search for imports");
        }
        
        if (!file_exists($this->getSchemasPath())) {
            throw new \RuntimeException("Schemas path doesn't exist - cannot start search for imports");
        }
        
        if ($this->getPublicPath() == null || !file_exists($this->getPublicPath())) {
            throw new \RuntimeException("Public folder for imported schemas is not specified or is not exist - cannot save imports");
        }
        
        if (!is_readable($this->getSchemasPath())) {
            throw new \RuntimeException($this->getSchemasPath()." is not readable");
        }
        
        if (!is_writeable($this->getPublicPath())) {
            throw new \RuntimeException($this->getPublicPath()." is not writable");
        }
        // Scan directory for xsd files
        
        $dir   = new \RecursiveDirectoryIterator(realpath($this->getSchemasPath()));
        $iter  = new \RecursiveIteratorIterator($dir);
        $regex = new \RegexIterator($iter, '/\.xsd$/', \RecursiveRegexIterator::MATCH);
        $files = array();
        foreach ($regex as $key => $value) {
            array_push($files, $key);
        }
        $schema = "";
        foreach ($files as $file) {
            if ($this->isTargetNamespaceEqualsTo($file, $ns)) {
                $schema = $file;
            }
        }
        
        if ($schema == "") {
            throw new \RuntimeException("Cannot find schema for namespace ".$ns." in ".realpath($this->getSchemasPath()));
        }
        
        return $schema;
    }
public function getSchemaLocation($ns)
    {
        if ($this->getSchemasPath() == null) {
            throw new \RuntimeException("Schemas path is not specified - cannot start search for imports");
        }
        
        if (!file_exists($this->getSchemasPath())) {
            throw new \RuntimeException("Schemas path doesn't exist - cannot start search for imports");
        }
        
        if ($this->getPublicPath() == null || !file_exists($this->getPublicPath())) {
            throw new \RuntimeException("Public folder for imported schemas is not specified or is not exist - cannot save imports");
        }
        
        if (!is_readable($this->getSchemasPath())) {
            throw new \RuntimeException($this->getSchemasPath()." is not readable");
        }
        
        if (!is_writeable($this->getPublicPath())) {
            throw new \RuntimeException($this->getPublicPath()." is not writable");
        }
        // Scan directory for xsd files
        
        $dir   = new \RecursiveDirectoryIterator(realpath($this->getSchemasPath()));
        $iter  = new \RecursiveIteratorIterator($dir);
        $regex = new \RegexIterator($iter, '/\.xsd$/', \RecursiveRegexIterator::MATCH);
        $files = array();
        foreach ($regex as $key => $value) {
            array_push($files, $key);
        }
        $schema = "";
        foreach ($files as $file) {
            if ($this->isTargetNamespaceEqualsTo($file, $ns)) {
                $schema = $file;
            }
        }
        
        if ($schema == "") {
            throw new \RuntimeException("Cannot find schema for namespace ".$ns." in ".realpath($this->getSchemasPath()));
        }
        
        return $schema;
    }
Get path to schema in schemasPath with targetNamespace = $ns

@param string $ns Namespace to match

@return string absolut path to schema file
@throws RuntimeException If SchemaPath is not specified
@throws RuntimeException If Public folder is not specified
@throws RuntimeException If SchemaPath is not readable
@throws RuntimeException If PublicPath is not writable
@throws RuntimeException If namespace cannot be found in SchemaPath