function XmlFileLoader::parseNode
Parses a node from a loaded XML file.
Throws
\InvalidArgumentException When the XML is invalid
1 call to XmlFileLoader::parseNode()
- XmlFileLoader::load in vendor/
symfony/ routing/ Loader/ XmlFileLoader.php
File
-
vendor/
symfony/ routing/ Loader/ XmlFileLoader.php, line 67
Class
- XmlFileLoader
- XmlFileLoader loads XML routing files.
Namespace
Symfony\Component\Routing\LoaderCode
protected function parseNode(RouteCollection $collection, \DOMElement $node, string $path, string $file) : void {
if (self::NAMESPACE_URI !== $node->namespaceURI) {
return;
}
switch ($node->localName) {
case 'route':
$this->parseRoute($collection, $node, $path);
break;
case 'import':
$this->parseImport($collection, $node, $path, $file);
break;
case 'when':
if (!$this->env || $node->getAttribute('env') !== $this->env) {
break;
}
foreach ($node->childNodes as $node) {
if ($node instanceof \DOMElement) {
$this->parseNode($collection, $node, $path, $file);
}
}
break;
default:
throw new \InvalidArgumentException(\sprintf('Unknown tag "%s" used in file "%s". Expected "route" or "import".', $node->localName, $path));
}
}