文档 下载安装 问答 主机

magento 2.2 referenceBlock referenceContainer 报错

报错类似:

at /data/wwwroot/vendor/magento/framework/Config/Dom.php:396)"} []
[2021-08-09 12:55:49] main.CRITICAL: Element 'referenceBlock', attribute 'class': The attribute 'class' is not allowed.
Line: 1283

Element 'referenceBlock', attribute 'as': The attribute 'as' is not allowed.
Line: 1283

Element 'referenceContainer', attribute 'htmlTag': [facet 'enumeration'] The value '' is not an element of the set {'aside', 'dd', 'div', 'dl', 'fieldset', 'main', 'nav', 'header', 'footer', 'ol', 'p', 'section', 'table', 'tfoot', 'ul'}.
Line: 1289

Element 'referenceContainer', attribute 'htmlClass': [facet 'pattern'] The value '' is not accepted by the pattern '[a-zA-Z][a-zA-Z\d\-_]*(\s[a-zA-Z][a-zA-Z\d\-_]*)*'.
Line: 1289

Element 'referenceContainer', attribute 'before': The attribute 'before' is not allowed.
Line: 1289

Element 'referenceContainer', attribute 'htmlTag': [facet 'enumeration'] The value '' is not an element of the set {'aside', 'dd', 'div', 'dl', 'fieldset', 'main', 'nav', 'header', 'footer', 'ol', 'p', 'section', 'table', 'tfoot', 'ul'}.
Line: 1290

Element 'referenceContainer', attribute 'htmlClass': [facet 'pattern'] The value '' is not accepted by the pattern '[a-zA-Z][a-zA-Z\d\-_]*(\s[a-zA-Z][a-zA-Z\d\-_]*)*'.
Line: 1290

Element 'referenceContainer', attribute 'after': The attribute 'after' is not allowed.
Line: 1290
 {"exception":"[object] (Magento\\Framework\\Config\\Dom\\ValidationException(code: 0): Element 'referenceBlock', attribute 'class': The attribute 'class' is not allowed.
Line: 1283

Element 'referenceBlock', attribute 'as': The attribute 'as' is not allowed.
Line: 1283

Element 'referenceContainer', attribute 'htmlTag': [facet 'enumeration'] The value '' is not an element of the set {'aside', 'dd', 'div', 'dl', 'fieldset', 'main', 'nav', 'header', 'footer', 'ol', 'p', 'section', 'table', 'tfoot', 'ul'}.
Line: 1289

原因是Magento2.2之后对xml格式限制更严格,所以按照错误提示修复xml文件即可