static public function getXsdLocation(DOMDocument $document, $namespaceUri)
    {
        $root = $document->documentElement;
        $location = false;
        
        if (empty($root) === false) {
            $schemaLocation = $root->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation');
            if (empty($schemaLocation) === false) {
                $parts = preg_split('/\s+/', $schemaLocation);
                
                // Look at pairs...
                $partsCount = count($parts);
                for ($i = 0; $i < $partsCount; $i += 2) {
                    if (isset($parts[$i + 1]) && $parts[$i] === $namespaceUri) {
                        $location = $parts[$i + 1];
                        break;
                    }
                }
            }
        }
        
        return $location;
    }
static public function getXsdLocation(DOMDocument $document, $namespaceUri)
    {
        $root = $document->documentElement;
        $location = false;
        
        if (empty($root) === false) {
            $schemaLocation = $root->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation');
            if (empty($schemaLocation) === false) {
                $parts = preg_split('/\s+/', $schemaLocation);
                
                // Look at pairs...
                $partsCount = count($parts);
                for ($i = 0; $i < $partsCount; $i += 2) {
                    if (isset($parts[$i + 1]) && $parts[$i] === $namespaceUri) {
                        $location = $parts[$i + 1];
                        break;
                    }
                }
            }
        }
        
        return $location;
    }
static public function getXsdLocation ( DOMDocument $ document , $ namespaceUri ) { $ root = $ document -> documentElement ; $ location = false ; if ( empty ( $ root ) === false ) { $ schemaLocation = $ root -> getAttributeNS ( 'http://www.w3.org/2001/XMLSchema-instance' , 'schemaLocation' ) ; if ( empty ( $ schemaLocation ) === false ) { $ parts = preg_split ( '/\s+/' , $ schemaLocation ) ; // Look at pairs... $ partsCount = count ( $ parts ) ; for ( $ i = 0 ; $ i < $ partsCount ; $ i += 2 ) { if ( isset ( $ parts [ $ i + 1 ] ) && $ parts [ $ i ] === $ namespaceUri ) { $ location = $ parts [ $ i + 1 ] ; break ; } } } } return $ location ; }
Get the location of an XML Schema Definition file from a given namespace.

This utility method enables you to know what is the location of an XML Schema Definition
file to be used to validate a $document for a given target namespace.

@param DOMDocument $document A DOMDocument object.
@param string $namespaceUri A Namespace URI you want to know the related XSD file location.
@return boolean|string False if no location can be found for $namespaceUri, otherwise the location of the XSD file.
Get the location of an XML Schema Definition file from a given namespace .