Edit in GitHubLog an issue

URN schema validation

Each module can contain XSD files for XML validation.

The application uses Uniform Resource Names (URNs) to reference XML schema declarations.

The application supported URNs begin with urn:magento. The application supports two XSD reference types:

  • Module XSD
  • Framework XSD

Module XSD

The syntax for the module XSD is a colon separated declaration. An example follows:

urn:magento:module:Magento_Flow:flows/content.xsd

where

  • urn:magento is the URN identifier
  • module is the reference type identifier
  • Magento_Flow is the name of the module. This must be exactly the same as the module specified by ComponentRegistrar in the registration.php file.
  • flows/content.xsd is the relative path to the module’s directory.

Framework XSD

The syntax for the framework XSD is a colon separated declaration. An example follows:

urn:magento:framework:Api/etc/extension_attributes.xsd

where

  • urn:magento is the URN identifier
  • framework is the reference type identifier. You can also add additional framework libraries as separate components with framework-<sub-name>
  • Api/etc/extension_attributes.xsd is the relative path to the framework’s directory.

Referencing a XSD from another XSD

Use URN notation to reference schema from inside a XSD document:

Copied to your clipboard
<xs:redefine schemaLocation="urn:magento:framework:Config/etc/view.xsd">

The URN resolution is invoked automatically by the libxml engine. Register the URN resolver by using libxml_set_external_entity_loader:

Copied to your clipboard
libxml_set_external_entity_loader(['Magento\Framework\Config\Dom\UrnResolver', 'registerEntityLoader']);
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.