0

I change the deploy mode to developer on Magento 2 and now I see the following error:

1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block': This element is not expected. Expected is one of ( title, css, link, meta, script, remove, attribute ).
Line: 642


Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block': This element is not expected. Expected is one of ( title, css, link, meta, script, remove, attribute ).
Line: 642

#0 /public_html/vendor/magento/framework/Config/Dom.php(115): Magento\Framework\Config\Dom->_initDom('<layout xmlns:x...')
#1 /public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Config\Dom->__construct('<layout xmlns:x...', Object(Magento\Framework\App\Arguments\ValidationState), Array, NULL, '/home/fitvehic/...', '%message%\nLine:...')
#2 /public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#3 /public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#4 /public_html/vendor/magento/framework/Config/DomFactory.php(42): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array)
#5 /public_html/vendor/magento/framework/View/Model/Layout/Update/Validator.php(141): Magento\Framework\Config\DomFactory->createDom(Array)
#6 /public_html/vendor/magento/framework/View/Model/Layout/Merge.php(461): Magento\Framework\View\Model\Layout\Update\Validator->isValid('<layout xmlns:x...', 'layout_merged', false)
#7 /public_html/vendor/magento/framework/View/Model/Layout/Merge.php(442): Magento\Framework\View\Model\Layout\Merge->_validateMergedLayout('LAYOUT_frontend...', '<body>\n   <refe...')
#8 /public_html/generated/code/Magento/Framework/View/Model/Layout/Merge/Interceptor.php(193): Magento\Framework\View\Model\Layout\Merge->load(Array)
#9 /public_html/vendor/magento/framework/View/Layout/Builder.php(86): Magento\Framework\View\Model\Layout\Merge\Interceptor->load()
#10 /public_html/vendor/magento/framework/View/Layout/Builder.php(63): Magento\Framework\View\Layout\Builder->loadLayoutUpdates()
#11 /public_html/vendor/magento/framework/View/Layout.php(254): Magento\Framework\View\Layout\Builder->build()
#12 /public_html/vendor/magento/framework/View/Layout.php(875): Magento\Framework\View\Layout->build()
#13 /public_html/generated/code/Magento/Framework/View/Layout/Interceptor.php(414): Magento\Framework\View\Layout->getBlock('page_content_he...')
#14 /public_html/vendor/magento/module-cms/Helper/Page.php(171): Magento\Framework\View\Layout\Interceptor->getBlock('page_content_he...')
#15 /public_html/vendor/magento/module-cms/Controller/Index/Index.php(43): Magento\Cms\Helper\Page->prepareResultPage(Object(Magento\Cms\Controller\Index\Index\Interceptor), 'grandesport_lay...')
#16 /public_html/generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(24): Magento\Cms\Controller\Index\Index->execute(NULL)
#17 /public_html/vendor/magento/framework/App/Action/Action.php(107): Magento\Cms\Controller\Index\Index\Interceptor->execute()
#18 /public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#19 /public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Cms\Controller\Index\Index\Interceptor->___callParent('dispatch', Array)
#20 /public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#21 /public_html/generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(39): Magento\Cms\Controller\Index\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#22 /public_html/vendor/magento/framework/App/FrontController.php(55): Magento\Cms\Controller\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#23 /public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#24 /public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#25 /public_html/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 /public_html/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 /public_html/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))
#28 /public_html/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))
#29 /public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#30 /public_html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#31 /public_html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#32 /public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#33 /public_html/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()
#34 /public_html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#35 {main}

Also in the debug file I have this:

[2019-07-01 19:44:46] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_4dd32ce4e9a4da9f99b408194db562ca2 and handles default, customer_account_create: Please correct the XML data and try again. Element 'block': This element is not expected. Expected is one of ( title, css, link, meta, script, remove, attribute ).
Line: 642
 [] []
[2019-07-01 19:46:25] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_4999a55d7d9f00b9a016b5e16762ce70a and handles default, customer_account_login: Please correct the XML data and try again. Element 'block': This element is not expected. Expected is one of ( title, css, link, meta, script, remove, attribute ).
Line: 642
 [] []
[2019-07-01 19:46:30] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_41a25b71f07a44338e9e39cdd0ac4a8b7 and handles default, cms_index_index, cms_page_view, cms_index_index_id_grandesport_layout2_home: Please correct the XML data and try again. Element 'block': This element is not expected. Expected is one of ( title, css, link, meta, script, remove, attribute ).
Line: 642

what I can do to find where is the problem?

Thank you

1 Answer 1

3

The errors are invalid XML

There is a plugin for PHPstorm editor

https://github.com/magento/magento2-phpstorm-plugin

You can then generate XML URN map to validate against.

https://magento.stackexchange.com/a/101524/70343

Or better yet you can scan your code. I was going to type an answer on how to use it but then I came across this

https://magento.stackexchange.com/a/227343/70343

The part you are interested in is 'How to use PhpStorm code inspector to validate project xml-files'

Let me know if any detail gets lost in translation.

But basically after generating the URN you can scan your code.

enter image description here

1
  • thank you so much for your help, I really appreciate it.
    – Robert
    Commented Jul 2, 2019 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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