public function supports($resource, $type = null)
{
if (!is_string($resource) || 'xml' !== pathinfo($resource, PATHINFO_EXTENSION)) {
return false;
}
$document = XmlUtils::loadFile($resource);
$namespaces = $document->documentElement->attributes->getNamedItem('schemaLocation')->nodeValue;
$start = strpos($namespaces, static::SCHEMA_IDENTIFIER) + strlen(static::SCHEMA_IDENTIFIER) + 1;
$namespace = substr($namespaces, $start);
$end = strpos($namespace, ' ');
if ($end !== false) {
$namespace = substr($namespace, 0, $end);
}
return $namespace === static::SCHEMA_URI;
}