Magento2 - Element 'body': Character content other than whitespace is not allowed because the content type is 'element-only

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

Question

I'm getting error in checkout page like below. No file name listed here to debug. how can i fix this. please help.

1 exception(s):

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'body': Character content other than whitespace is not allowed because the content type is 'element-only'

. Line: 3345

#1 Magento\Framework\Config\Dom->__construct('createObject('Magento\Framewor...', array('create('Magento\Framewor...', array('xml' => ' 'D:/xampp-windows...', 'validationState' => &Magento\Framework\App\Arguments\ValidationState#000000002a61bd2000000000348b0fc6#)) called at [vendor\magento\framework\ObjectManager\ObjectManager.php:56]
#4 Magento\Framework\ObjectManager\ObjectManager->create('Magento\Framewor...', array('xml' => ' 'D:/xampp-windows...', 'validationState' => &Magento\Framework\App\Arguments\ValidationState#000000002a61bd2000000000348b0fc6#)) called at [vendor\magento\framework\Config\DomFactory.php:43]
#5 Magento\Framework\Config\DomFactory->createDom(array('xml' => ' 'D:/xampp-windows...', 'validationState' => &Magento\Framework\App\Arguments\ValidationState#000000002a61bd2000000000348b0fc6#)) called at [vendor\magento\framework\View\Model\Layout\Update\Validator.php:141]
#6 Magento\Framework\View\Model\Layout\Update\Validator->isValid('_validateMergedLayout('LAYOUT_frontend_...', '\n   load(array()) called at [generated\code\Magento\Framework\View\Model\Layout\Merge\Interceptor.php:193]
#9 Magento\Framework\View\Model\Layout\Merge\Interceptor->load() called at [vendor\magento\framework\View\Layout\Builder.php:86]
#10 Magento\Framework\View\Layout\Builder->loadLayoutUpdates() called at [vendor\magento\framework\View\Layout\Builder.php:63]
#11 Magento\Framework\View\Layout\Builder->build() called at [vendor\magento\framework\View\Page\Config.php:212]
#12 Magento\Framework\View\Page\Config->build() called at [vendor\magento\framework\View\Page\Config.php:235]
#13 Magento\Framework\View\Page\Config->getTitle() called at [vendor\magento\module-checkout\Controller\Index\Index.php:48]
#14 Magento\Checkout\Controller\Index\Index->execute() called at [vendor\magento\framework\Interception\Interceptor.php:58]
#15 Magento\Checkout\Controller\Index\Index\Interceptor->___callParent('execute', array()) called at [vendor\magento\framework\Interception\Interceptor.php:138]
#16 Magento\Checkout\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor\magento\framework\Interception\Interceptor.php:153]
#17 Magento\Checkout\Controller\Index\Index\Interceptor->___callPlugins('execute', array(), array(array('amazon_login_che...'), array('multishipping_di...'))) called at [generated\code\Magento\Checkout\Controller\Index\Index\Interceptor.php:26]
#18 Magento\Checkout\Controller\Index\Index\Interceptor->execute() called at [vendor\magento\framework\App\Action\Action.php:108]
#19 Magento\Framework\App\Action\Action->dispatch(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\module-checkout\Controller\Onepage.php:161]
#20 Magento\Checkout\Controller\Onepage->dispatch(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\Interception\Interceptor.php:58]
#21 Magento\Checkout\Controller\Index\Index\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#)) called at [vendor\magento\framework\Interception\Interceptor.php:138]
#22 Magento\Checkout\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\module-customer-segment\Model\App\Action\ContextPlugin.php:81]
#23 Magento\CustomerSegment\Model\App\Action\ContextPlugin->aroundDispatch(&Magento\Checkout\Controller\Index\Index\Interceptor#000000002a61bfcf00000000348b0fc6#, &Closure#000000002a61bfcc00000000348b0fc6#, &Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\Interception\Interceptor.php:135]
#24 Magento\Checkout\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\Interception\Interceptor.php:153]
#25 Magento\Checkout\Controller\Index\Index\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#), NULL) called at [generated\code\Magento\Checkout\Controller\Index\Index\Interceptor.php:39]
#26 Magento\Checkout\Controller\Index\Index\Interceptor->dispatch(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\App\FrontController.php:159]
#27 Magento\Framework\App\FrontController->processRequest(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#, &Magento\Checkout\Controller\Index\Index\Interceptor#000000002a61bfcf00000000348b0fc6#) called at [vendor\magento\framework\App\FrontController.php:99]
#28 Magento\Framework\App\FrontController->dispatch(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\Interception\Interceptor.php:58]
#29 Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#)) called at [vendor\magento\framework\Interception\Interceptor.php:138]
#30 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\module-store\App\FrontController\Plugin\RequestPreprocessor.php:94]
#31 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#000000002a61bd7e00000000348b0fc6#, &Closure#000000002a61bdcc00000000348b0fc6#, &Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\Interception\Interceptor.php:135]
#32 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\module-page-cache\Model\App\FrontController\BuiltinPlugin.php:73]
#33 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#000000002a61bd7e00000000348b0fc6#, &Closure#000000002a61bdcc00000000348b0fc6#, &Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\Interception\Interceptor.php:135]
#34 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\Interception\Interceptor.php:153]
#35 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#), NULL) called at [generated\code\Magento\Framework\App\FrontController\Interceptor.php:26]
#36 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#000000002a61bce300000000348b0fc6#) called at [vendor\magento\framework\App\Http.php:136]
#37 Magento\Framework\App\Http->launch() called at [generated\code\Magento\Framework\App\Http\Interceptor.php:24]
#38 Magento\Framework\App\Http\Interceptor->launch() called at [vendor\magento\framework\App\Bootstrap.php:258]
#39 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000002a61bcaf00000000348b0fc6#) called at [index.php:39]
Was it helpful?

Solution

Ans: I have fixed this by adding UTF-8 encoding to all checkout_index_index.xml file and removed all unwanted spaces.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top