Upgrade from Magento CE 2.1.8 to 2.2.2 - GETTING ERROR : Element 'block', attribute 'class': [facet 'pattern'] is not accepted by the pattern

magento.stackexchange https://magento.stackexchange.com/questions/316132

  •  14-04-2021
  •  | 
  •  

Question

i am getting below error while Upgrade from Magento CE 2.1.8 to 2.2.2.

Admin is working well.

Front end giving error as below. please help me.

   1 exception(s):
         Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 
         'block', attribute 'class': [facet 'pattern'] The value 
         '\\Magento\Framework\View\Element\Template' is not accepted by the pattern 
         '[A-Z][_a-zA-Z\d]*(\\[A-Z][_a-zA-Z\d]*)*'.
         Line: 717

        Element 'block', attribute 'class': 
        '\\Magento\Framework\View\Element\Template' is not a valid value of the 
        atomic type 'blockClassType'.
        Line: 717

        Element 'customer_logged_in': This element is not expected. Expected is one 
        of ( attribute, block, referenceBlock, referenceContainer, container, move, 
        uiComponent ).
        Line: 724

        Element 'block', attribute 'remove': The attribute 'remove' is not allowed.
        Line: 818

        Element 'move', attribute 'name': The attribute 'name' is not allowed.
        Line: 907

        Element 'move', attribute 'name': The attribute 'name' is not allowed.
        Line: 908

        Element 'remove': This element is not expected. Expected is one of ( block, 
        container, referenceBlock, referenceContainer, uiComponent ).
        Line: 927


        Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 
         'block', attribute 'class': [facet 'pattern'] The value '\\Magento\Framework\View\Element\Template' is not accepted by the pattern '[A-Z][_a-zA-Z\d]*(\\[A-Z][_a-zA-Z\d]*)*'.
    Line: 717

    Element 'block', attribute 'class': '\\Magento\Framework\View\Element\Template' is not a valid value of the atomic type 'blockClassType'.
    Line: 717

    Element 'customer_logged_in': This element is not expected. Expected is one of ( attribute, block, referenceBlock, referenceContainer, container, move, uiComponent ).
    Line: 724

    Element 'block', attribute 'remove': The attribute 'remove' is not allowed.
    Line: 818

    Element 'move', attribute 'name': The attribute 'name' is not allowed.
    Line: 907

    Element 'move', attribute 'name': The attribute 'name' is not allowed.
    Line: 908

    Element 'remove': This element is not expected. Expected is one of ( block, container, referenceBlock, referenceContainer, uiComponent ).
    Line: 927

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

Solution

You need to fix these errors one by one. XML syntax differ for M2.2. You need to analyse it one by one in your theme and modules .

M2.2 parses xml very thoroughly. 'remove' cannot be used . its deprecated in 2.2

Check your xmls from DB also while fixing(For design)

M2.1 - <remove name="block_name"/>

M2.2 - <referenceBlock name="block_name" remove="true"/>

Remove leading backslashes: '\\Magento\Framework\View\Element\Template' -> 'Magento\Framework\View\Element\Template'

You need to fix these.

Also go through the link for css/js/scripts http://ahmadvaqaskhan.blogspot.in/2018/02/magento-21x-vs-22x-difference-in.html

OTHER TIPS

I fixed the same error with removing the attributes without value.

From:

<block class="" name="" template="Magento_Theme::video_stream.phtml" />

to:

<block template="Magento_Theme::video_stream.phtml" />
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top