1

Is there any restriction in Magento 2 with the length of the Vendor name for minimum of 3 ?

I have a vendor say: AB_Test

after upgrading the module, i get:

Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid Document 
Element 'add', attribute 'title': [facet 'minLength'] The value 'AB' has a length of '2'; this underruns the allowed minimum length of '3'.
Line: 26

And other modules which are under 'AB' works fine.

Is it any xml issue or is it a restriction?

I do not get proper solution over the net for this issue.

UPDATE:

menu.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd">
<menu> 
    <add id="HM_Brand::brand" title="Brand" module="HM_Brand" sortOrder="40" resource="HM_Brand::brand" parent="HM_All::hm_all"/>  
    <add id="HM_Brand::brand_new" title="Add New Brand" module="HM_Brand" sortOrder="10" parent="HM_Brand::brand" action="hmbrand/brand/new" resource="HM_Brand::brand"/> 
    <add id="HM_Brand::brand_manage" title="Manage Brands" module="HM_Brand" sortOrder="20" parent="HM_Brand::brand" action="hmbrand/brand/index" resource="HM_Brand::brand"/>
    <add id="HM_Brand::brand_group_manage" title="Manage Groups" module="HM_Brand" sortOrder="40" parent="HM_Brand::brand" action="hmbrand/group/index" resource="HM_Brand::group"/> 
    <add id="HM_Brand::configuration" title="Settings" module="HM_Brand" sortOrder="50"
        parent="HM_Brand::brand" action="adminhtml/system_config/edit/section/hmbrand" resource="HM_Brand::config_brand"/>
</menu>

  • Invalid document means there some xml issue. – Prasanta Hatui Feb 27 '17 at 11:35
1

It is an XML restriction in your menu.xml.

Indeed, according to the menu.xsd validation schema there are several restrictions to the attributes of the add element, in your case:

<xs:simpleType name="typeTitle">
    <xs:annotation>
        <xs:documentation>
            Item title attribute minimal length 3 symbol
        </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
        <xs:minLength value="3" />
        <xs:maxLength value="50" />
    </xs:restriction>
</xs:simpleType>

The title length must be between 3 and 50 characters

  • I have updated menu.xml in my question, since i have anywhere not used or set the min lenght, i guess its set in Magento/Backend/etc/menu.xsd !!! – Sushivam Feb 27 '17 at 12:17
  • @SachinS yes that's correct – Raphael at Digital Pianism Feb 27 '17 at 12:23
  • So suggested way is we have to give min 3 length in our namespace since we cannot change the core file – Sushivam Feb 27 '17 at 12:24
  • @SachinS yup 100% correct – Raphael at Digital Pianism Feb 27 '17 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.