Magento 2
XML schema resolution
Free Preview
🟢 Good code
<!--
Specifying a Uniform Resource Name (URN) for an XML schema location is Magento's
preferred implementation method. This decouples hard-coded XML schema locations
by replacing them with dynamic addresses which can be changed at a later date.

URN format for module:
urn:magento:module:Foo_Bar:<relative_path>

URN format for Magento Framework:
urn:magento:framework:Module/<relative_path>

Execute `bin/magento dev:urn-catalog:generate` to generate URNs for your IDE.
-->
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    ...
🔴 Bad code
<!--
Specifying a relative path for an XML schema location is not recommended.
The location of the Magento Framework should not be pre-determined, as this
location can change over time (for example, local vs. Composer installation).
-->
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:noNamespaceSchemaLocation="../../lib/Magento/Framework/Acl/etc/acl.xsd">
    ...
Want to learn more?

Visit M.academy to learn much more about Magento, Laravel, PHP, Javascript, & Docker.

M.academy logo