magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Consider using namespaces for XML schemas

Open joshdifabio opened this issue 12 years ago • 3 comments

I believe Magento 2's XML schemas should each specify a target XML namespace.

The current approach (referencing schemas using the noNamespaceSchemaLocation attribute within XML files) requires implementers to know the exact location of a schema relative to the XML file which they are defining, which won't always be practical, even if Magento 2 does impose a rigid directory structure (there will likely be components other than Magento 2 modules which consume those schemas).

If you decide to introduce namespaces for Magento 2's XML schemas then I think there is a choice to be made between using URNs or URLs as XML namespace identifiers, each of which have their own limitations and benefits.

My personal preference would be to use URNs, for example urn:magento:schemas:config.

joshdifabio avatar Oct 27 '14 12:10 joshdifabio

Thanks for raising this one. (We were discussing recently internally as well.) Is it the relative paths you dislike to reference the XSD, or the lack of namespaces? These are distinct issues. It sounds like the relative paths are the real pain, not whether use use a namespace or not. Is that correct?

alankent avatar Oct 27 '14 19:10 alankent

I dislike both, really. The relative paths make referencing schemas by location slightly awkward. The lack of namespaces means there is no effective way of identifying schemas outside of the application, for example in documentation.

joshdifabio avatar Oct 28 '14 09:10 joshdifabio

Internal ticket: MAGETWO-30492

vpelipenko avatar Jan 29 '15 12:01 vpelipenko