cancel
Showing results for 
Search instead for 
Did you mean: 

differences in "noNamespaceSchemaLocation"

SOLVED

differences in "noNamespaceSchemaLocation"

Hi,

 

I have seen some magento developers that write:

 

xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">

but others use:

 

 

xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/lib/internal/Magento/Framework/Module/etc/module.xsd">

I see more clear, concise and correct the second one (in my learner opinion), but some good M2 developers use the first approach, and my question is... why?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: differences in "noNamespaceSchemaLocation"

Hello @HHFFPP,

 

Magento code references all XSD schemas as Uniform Resource Names (URNs). If you’re developing code and need to reference XSDs, this command configures your integrated developer environment (IDE) to recognize and highlight URNs. This makes development easier.

By default, an IDE like PHPStorm is not configured to recognize URNs and, as a result, they display in red text as follows:

config_urn_before.png

The bin/magento dev:urn-catalog:generate command enables your IDE (currently, only PHPStorm) to recognize and highlight URNs like the following:

config_urn_after.png

Specifically, this command creates the following PHPStorm configuration:

config_urn_settings.png

 

Configure your IDE
Currently, only PHPStorm is supported.

Command syntax:

$ bin/magento dev:urn-catalog:generate <path>

Where <path> is the path to your PHPStorm misc.xml file, which is located relative to your project root. Typically, <path> is .idea/misc.xml.

 

--
If my answer is useful, please Accept as Solution & give Kudos

View solution in original post

3 REPLIES 3

Re: differences in "noNamespaceSchemaLocation"

Hello @HHFFPP

 

It depends on the type of XML file you create.

Basically, all the XSD files can be found under the lib/internal/Magento/Framework folder,

 

Here you can follow official docs:

Kudos and accept it as a solution if it works for you. Cheers coding Smiley Happy

Manish Mittal
https://www.manishmittal.com/

Re: differences in "noNamespaceSchemaLocation"

Hello @HHFFPP,

 

Magento code references all XSD schemas as Uniform Resource Names (URNs). If you’re developing code and need to reference XSDs, this command configures your integrated developer environment (IDE) to recognize and highlight URNs. This makes development easier.

By default, an IDE like PHPStorm is not configured to recognize URNs and, as a result, they display in red text as follows:

config_urn_before.png

The bin/magento dev:urn-catalog:generate command enables your IDE (currently, only PHPStorm) to recognize and highlight URNs like the following:

config_urn_after.png

Specifically, this command creates the following PHPStorm configuration:

config_urn_settings.png

 

Configure your IDE
Currently, only PHPStorm is supported.

Command syntax:

$ bin/magento dev:urn-catalog:generate <path>

Where <path> is the path to your PHPStorm misc.xml file, which is located relative to your project root. Typically, <path> is .idea/misc.xml.

 

--
If my answer is useful, please Accept as Solution & give Kudos

Re: differences in "noNamespaceSchemaLocation"

Good answer, but it could be great only if I could see the images, I don't know why, but I can't see them