我在magento 2中收到此错误。我没有做任何更新,这个错误突然出现了。
我看到我必须删除"""属性,但我在哪里可以找到?
1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceContainer', attribute 'after': The attribute 'after' is not allowed.
Line: 1251
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceContainer', attribute 'after': The attribute 'after' is not allowed.
Line: 1251
#0 /www/htdocs/domain/vendor/magento/framework/Config/Dom.php(115): Magento\Framework\Config\Dom->_initDom('<layout xmlns:x...')
#1 /www/htdocs/domain/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Config\Dom->__construct('<layout xmlns:x...', Object(Magento\Framework\App\Arguments\ValidationState), Array, NULL, '/www/htdocs/w00...', '%message%\nLine:...')
#2 /www/htdocs/domain/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#3 /www/htdocs/domain/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#4 /www/htdocs/domain/vendor/magento/framework/Config/DomFactory.php(42): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array)
#5 /www/htdocs/domain/vendor/magento/framework/View/Model/Layout/Update/Validator.php(125): Magento\Framework\Config\DomFactory->createDom(Array)
#6 /www/htdocs/domain/vendor/magento/framework/View/Model/Layout/Merge.php(461): Magento\Framework\View\Model\Layout\Update\Validator->isValid('<layout xmlns:x...', 'layout_merged', false)
#7 /www/htdocs/domain/vendor/magento/framework/View/Model/Layout/Merge.php(442): Magento\Framework\View\Model\Layout\Merge->_validateMergedLayout('LAYOUT_frontend...', '<body>\n <refe...')
#8 /www/htdocs/domain/generated/code/Magento/Framework/View/Model/Layout/Merge/Interceptor.php(193): Magento\Framework\View\Model\Layout\Merge->load(Array)
#9 /www/htdocs/domain/vendor/magento/framework/View/Layout/Builder.php(86): Magento\Framework\View\Model\Layout\Merge\Interceptor->load()
#10 /www/htdocs/domain/vendor/magento/framework/View/Layout/Builder.php(63): Magento\Framework\View\Layout\Builder->loadLayoutUpdates()
#11 /www/htdocs/domain/vendor/magento/framework/View/Layout.php(254): Magento\Framework\View\Layout\Builder->build()
#12 /www/htdocs/domain/vendor/magento/framework/View/Layout.php(875): Magento\Framework\View\Layout->build()
#13 /www/htdocs/domain/generated/code/Magento/Framework/View/Layout/Interceptor.php(414): Magento\Framework\View\Layout->getBlock('page_content_he...')
#14 /www/htdocs/domain/vendor/magento/module-cms/Helper/Page.php(171): Magento\Framework\View\Layout\Interceptor->getBlock('page_content_he...')
#15 /www/htdocs/domain/vendor/magento/module-cms/Controller/Noroute/Index.php(44): Magento\Cms\Helper\Page->prepareResultPage(Object(Magento\Cms\Controller\Noroute\Index\Interceptor), 'no-route')
#16 /www/htdocs/domain/generated/code/Magento/Cms/Controller/Noroute/Index/Interceptor.php(24): Magento\Cms\Controller\Noroute\Index->execute()
#17 /www/htdocs/domain/vendor/magento/framework/App/Action/Action.php(107): Magento\Cms\Controller\Noroute\Index\Interceptor->execute()
#18 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#19 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Cms\Controller\Noroute\Index\Interceptor->___callParent('dispatch', Array)
#20 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Controller\Noroute\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#21 /www/htdocs/domain/generated/code/Magento/Cms/Controller/Noroute/Index/Interceptor.php(39): Magento\Cms\Controller\Noroute\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#22 /www/htdocs/domain/vendor/magento/framework/App/FrontController.php(55): Magento\Cms\Controller\Noroute\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#23 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#24 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#25 /www/htdocs/domain/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#26 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#27 /www/htdocs/domain/vendor/mirasvit/module-search-autocomplete/src/SearchAutocomplete/Plugin/ResponsePlugin.php(157): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#28 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(135): Mirasvit\SearchAutocomplete\Plugin\ResponsePlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#29 /www/htdocs/domain/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#30 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#31 /www/htdocs/domain/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#32 /www/htdocs/domain/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#33 /www/htdocs/domain/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#34 /www/htdocs/domain/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http->launch()
#35 /www/htdocs/domain/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#36 {main}
&#13;
我看到我必须删除&#34;&#34;&#34;属性,但我在哪里可以找到?
感谢
答案 0 :(得分:2)
您无法在referenceContainer中添加after属性。如果您想移动Container,请使用它。
<move element="element name" destination="where you want to move" after="">
答案 1 :(得分:1)
我想,您使用的是magento2.2版本。在这个版本中,布局xml有一些修改。您无法在after
代码中使用before
和referenceContainer
属性。
要解决此问题,您必须从after
中删除before
和referenceContainer
属性。
您可以使用move
标记重新排列布局
答案 2 :(得分:0)
您必须向扩展程序支持添加新故障单,因为这是扩展程序问题。您可以检查路径app / code / vendor_name / module_name / view / frontend / layout /
中的所有xml文件答案 3 :(得分:0)
正如zed所说,这看起来更像是对v2.2.x的升级问题,因为它们使布局格式更加严格,并且之前允许的一些内容不再存在。
before
代码中的after
和referenceContainer
属性不再有效。
我们还发现move
标记内也不再允许使用referenceBlock
标记。
要查找这些问题的位置,我进入vendor/magento/framework/Config/Dom.php
文件并在_initDom()
方法输出$xml
变量,以查找每个异常的第xxx行的实际xml代码就像OP上面的那个。