public function XmlFileLoader::load in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/routing/Loader/XmlFileLoader.php \Symfony\Component\Routing\Loader\XmlFileLoader::load()
- 8 vendor/symfony/dependency-injection/Loader/XmlFileLoader.php \Symfony\Component\DependencyInjection\Loader\XmlFileLoader::load()
Same name and namespace in other branches
- 8.0 vendor/symfony/routing/Loader/XmlFileLoader.php \Symfony\Component\Routing\Loader\XmlFileLoader::load()
Loads an XML file.
Parameters
string $file An XML file path:
string|null $type The resource type:
Return value
RouteCollection A RouteCollection instance
Throws
\InvalidArgumentException When the file cannot be loaded or when the XML cannot be parsed because it does not validate against the scheme.
File
- vendor/
symfony/ routing/ Loader/ XmlFileLoader.php, line 42
Class
- XmlFileLoader
- XmlFileLoader loads XML routing files.
Namespace
Symfony\Component\Routing\LoaderCode
public function load($file, $type = null) {
$path = $this->locator
->locate($file);
$xml = $this
->loadFile($path);
$collection = new RouteCollection();
$collection
->addResource(new FileResource($path));
// process routes and imports
foreach ($xml->documentElement->childNodes as $node) {
if (!$node instanceof \DOMElement) {
continue;
}
$this
->parseNode($collection, $node, $path, $file);
}
return $collection;
}