cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid XML in file ... Element is not accepted by the pattern

Invalid XML in file ... Element is not accepted by the pattern

Hi, we introduced a system.xml within the adminhtml folder of our custom integration with Magento, and with Magento 2.1.5 we saw the following error that we did not see with either 2.1.0 or 2.1.7:

 

1 exception(s):

Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid XML in file /var/www/magento2/app/code/MyCompany/MyAction/etc/adminhtml/system.xml:

Element 'resource': [facet 'pattern'] The value 'MyCompany_MyAction' is not accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.

Line: 11

 

When we updated MyCompany_MyAction to MyCompany_MyAction::Config, then it worked because the regex pattern appears to be enforcing the format of <CamelCaseString>_<CamelCaseString>::<CamelCaseString>.  However, this pattern did not appear to be enforced for Magento 2.1.0 or 2.1.7. 

 

My question is, should we be setting our "resource" values to the regex pattern detailed above, or was that regex enforced only 2.1.5?  Thank you.

2 REPLIES 2

Re: Invalid XML in file ... Element is not accepted by the pattern

Looks like it was an issue with the .xsd file that the xml's namespace was registered under.  It was enforcing that pattern at the xml level and the default PHP XML library was throwing an error when we tried to load the xml programmatically.

Re: Invalid XML in file ... Element is not accepted by the pattern

I am facing the same error but as much as I've figured it out that handler requires the path to the consumer file along with the method for message process method as:

handler="Vendor\Module\Model\Consumer\UpdateOrderConsumer:Smiley Tonguerocess"