!sourceDoc.getMimeType().equals("application/xquery"))
!sourceDoc.getMetadata().getMimeType().equals("application/xquery"))
	public void importModule(String namespaceURI, String prefix, String location)		throws XPathException {		Module module = getModule(namespaceURI);		if(module != null) {			LOG.debug("Module " + namespaceURI + " already present.");		} else {			if(location == null)				location = namespaceURI;			// is it a Java module?			if(location.startsWith(JAVA_URI_START)) {				location = location.substring(JAVA_URI_START.length());				module = loadBuiltInModule(namespaceURI, location);			} else {				Source source;                // Is the module source stored in the database?                if (location.startsWith(XMLDB_URI_START) || moduleLoadPath.startsWith(XMLDB_URI_START)) {                    //TODO : use dedicated function in XmldbURI                    if (location.indexOf(':') == Constants.STRING_NOT_FOUND)                        location = moduleLoadPath + "/" + location;                    String path = location.substring(XMLDB_URI_START.length());                    DocumentImpl sourceDoc = null;                    try {                        sourceDoc = broker.openDocument(path, Lock.READ_LOCK);                        if (sourceDoc == null)                            throw new XPathException("source for module " + location + " not found in database");                        if (sourceDoc.getResourceType() != DocumentImpl.BINARY_FILE ||                                !sourceDoc.getMimeType().equals("application/xquery"))                            throw new XPathException("source for module " + location + " is not an XQuery or " +                            "declares a wrong mime-type");                        source = new DBSource(broker, (BinaryDocument) sourceDoc, true);                        module = compileModule(namespaceURI, location, module, source);                    } catch (PermissionDeniedException e) {                        throw new XPathException("permission denied to read module source from " + location);                    } finally {                        if(sourceDoc != null)                            sourceDoc.getUpdateLock().release(Lock.READ_LOCK);                    }                // No. Load from file or URL                } else {                    try {                        source = SourceFactory.getSource(moduleLoadPath, location, true);                    } catch (MalformedURLException e) {                        throw new XPathException("source location for module " + namespaceURI + " should be a valid URL: " +                                e.getMessage());                    } catch (IOException e) {                        throw new XPathException("source for module " + namespaceURI + " not found: " +                                e.getMessage());                    }                    module = compileModule(namespaceURI, location, module, source);                }			}		}		if(prefix == null)			prefix = module.getDefaultPrefix();		declareNamespace(prefix, namespaceURI);	}