private function loadSchema($file)
{
// Retrieve schema and cache in UriRetriever
$file = Path::canonicalize($file);
// Add file:// scheme if necessary
if (false === strpos($file, '://')) {
$file = 'file://' . $file;
}
// Resolve references to other schemas
try {
$schema = $this->resolver->resolve($file);
} catch (ResourceNotFoundException $e) {
throw new InvalidSchemaException(sprintf('The schema %s does not exist.', $file), 0, $e);
}
try {
$this->assertSchemaValid($schema);
} catch (InvalidSchemaException $e) {
throw new InvalidSchemaException(sprintf('An error occurred while loading the schema %s: %s', $file, $e->getMessage()), 0, $e);
}
return $schema;
}