Magento 2 xml validation

Check updates to the GitHub today, Magento 2 introduced new command to automatically generate all the URN resolutions for the PhpStorm.

To use it:

  • have Magento installed on the same machine as PhpStorm
  • go to the root directory
  • execute command bin/magento dev:urn-catalog:generate .idea/misc.xml where .idea/misc.xml is path to your PhpStorm misc.xml file

All of the URNs should be magically resolved now!

Check them under PhpStorm->Preferences -> Languages&Frameworks -> Schemas and DTDs

PhpStorm 9.0 (windows) : File -> Settings -> Languages&Frameworks -> Schemas and DTDs


So magento changed the XSD URI to use Urns - These need to be configured in PHP Storm in order for schema validation to work again.

Source : http://alankent.me/2015/10/07/xml-schema-resolution-in-php-storm-with-urns-quick-note/

The URN resolution code is built into Magento directly. Luckily, it’s pretty easy to associate URNs with real files in your local site in PHP Strom.

This is what you will see after loading a newever magento2 version with urns. Notice the URN is in red because PHP Storm does not know how to resolve it.

enter image description here

Put the cursor in the URN then click on the red light bulb to the left that will appear and select “Manually Setup External Resource” from the list.

enter image description here

Scroll down the list of XSD files that PHP Storm has automatically located, and select the appropriate file. The red URN will now be shown in green, and XML validation is back in effect.


URN generation is supported by Magento 2 plugin for PHP Storm, and is only one of many useful features it provides to Magento 2 developers.

When plugin is installed in the PHP Storm, go to Preferences / Other Settings / Magento2 plugin and click Regenerate URN map.