Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. XmlFileLoader.php

function XmlFileLoader::load

Same name in this branch
  1. 11.1.x vendor/symfony/dependency-injection/Loader/XmlFileLoader.php \Symfony\Component\DependencyInjection\Loader\XmlFileLoader::load()

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 41

Class

XmlFileLoader
XmlFileLoader loads XML routing files.

Namespace

Symfony\Component\Routing\Loader

Code

public function load(mixed $file, ?string $type = null) : RouteCollection {
    $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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal