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:

data-variant=info
data-slots=text
You cannot change the XSD for any XML files provided with the Adobe Commerce and Magento Open Source applications.

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

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

Referencing a XSD from another XSD

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


<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:

libxml_set_external_entity_loader(['Magento\Framework\Config\Dom\UrnResolver', 'registerEntityLoader']);
data-variant=info
data-slots=text
The relative path to other XSDs cannot be used from inside the XSD file, because the entity loader fails to resolve the relative path.