function createComponentFromTag ($tagName, Component $parent, array $props = null, array $bindings = null,
                                   $generic = false, $strict = false)
  {
    $s = explode (':', $tagName, 2);
    if (count ($s) > 1)
      list ($prefix, $tagName) = $s;
    else $prefix = '';
    if (is_null ($props))
      $props = [];

    if ($prefix)
      throw new MatisseException ("XML namespaces are not yet supported.<p>Tag: <kbd>&lt;<b>$prefix:</b>$tagName&gt;</kbd>");

    if ($generic) {
      $component = new GenericHtmlComponent($tagName, $props);
      return $component;
    }
    $class = $this->getClassForTag ($tagName);
    /** @var DocumentContext $this */
    if (!$class) {
      if ($strict)
        Component::throwUnknownComponent ($this, $tagName, $parent);

      // Component class not found.
      // Convert the tag to a MacroInstance component instance that will attempt to load a macro with the same
      // name as the tag name.

      $component = $this->macrosService->createMacroInstance ($tagName);
    }

    // Component class was found.

    else $component = $this->injector->make ($class);

    // For both types of components:

    if (!$component instanceof Component)
      throw new ComponentException (null,
        sprintf ("Class <kbd>%s</kbd> is not a subclass of <kbd>Component</kbd>", get_class ($component)));

    $component->setTagName ($tagName);
    return $component->setup ($parent, $this, $props, $bindings);
  }